Handling User Signout

Learn how to handle authentication state changes in Firebase.

We'll cover the following

Upon successful authentication, the user is automatically signed in to our application. The Firebase Authentication SDK provides functions for handling user sign-out.

To sign a user out, we need to call the signOut function. This function is imported from the firebase/auth subpackage and takes the initialized authentication instance as a parameter. This function is asynchronous, and it returns a JavaScript promise that we can use to handle the function’s success value or failure reason:

Get hands-on with 1200+ tech skills courses.