Skip to main content

onAuthStateChanged()

Use onAuthStateChanged to add a custom function that will trigger whenever the state of the user changed. Ex from signed in to signed out or vice versa.

auth.onAuthStateChanged((event, session) => {
console.log(
`Auth state changed. State is now ${event} with session: ${session}`
)
})

Parameters


fn required AuthChangedFunction