Quick
@Firebase tip:
Save 263 kB on your first page load on mobile with Firebase V9:
If you are not using any OAuth Providers, then change
getAuth(app) to
initializeAuth(app, {
persistence: [
indexedDBLocalPersistence,
browserLocalPersistence,
],
})
![Code snippet: Compare implementation of getAuth() to initializeAuth() // This loads an 263 kB iframe.js on your first page load // (mobile only) with Firebase SDK V9. This iframe is only // needed for the methods signInWithPassword or // signInWithRedirect which are used for OAuth providers import { getAuth } from "firebase/auth"; const auth = getAuth(firebaseApp) // Use initializeAuth when you only want to use email/password // providers for example. import { initializeAuth, indexedDBLocalPersistence, browserSessionPersistence, browserLocalPersistence, } from "firebase/auth"; const auth = initializeAuth(firebaseApp, { persistence: [ indexedDBLocalPersistence, browserLocalPersistence, browserSessionPersistence, ], });](https://pbs.twimg.com/media/FERAgqmWUAsju-s.jpg?name=small&format=webp)
ALT Code snippet: Compare implementation of getAuth() to initializeAuth()
// This loads an 263 kB iframe.js on your first page load
// (mobile only) with Firebase SDK V9. This iframe is only
// needed for the methods signInWithPassword or
// signInWithRedirect which are used for OAuth providers
import { getAuth } from "firebase/auth";
const auth = getAuth(firebaseApp)
// Use initializeAuth when you only want to use email/password
// providers for example.
import {
initializeAuth,
indexedDBLocalPersistence,
browserSessionPersistence,
browserLocalPersistence,
} from "firebase/auth";
const auth = initializeAuth(firebaseApp, {
persistence: [
indexedDBLocalPersistence,
browserLocalPersistence,
browserSessionPersistence,
],
});