🔥 Free Firestore CRUD Queries Cheatsheet 👉 Get the PDF ×

Firebase Version 9 Tutorial (Modular)

INTRODUCTION

Add Firebase 10 to JavaScript Web App new

Add Firebase SDK via CDN coming soon

Add Firebase SDK via NPM new

FIRESTORE DATABASE

Firebase 10 DATA MODELING new

Firebase 10 ADD DATA addDoc() new

Firebase 10 ADD DATA setDoc() new

Firebase 10 UPDATE DATA setDoc() new

Firebase 10 UPDATE DATA updateDoc() new

Firebase 10 DELETE Document Field updateDoc() new

Firebase 10 DELETE Document delectDoc() new

Firebase 10 GET all Documents getDocs() new

Firebase 10 GET All Documents With Real-Time Updates onSnapshot() new

Firebase 10 GET A Document By ID getDoc() new

Firebase 10 WHERE Query new

Firebase 10 v9 vs v8 Query Comparison new

🔐 FIREBASE AUTHENTICATION

Firebase 10 Create A User Account using createUserWithEmailAndPassword() new

Firebase 10 Check User Authentication State Using onAuthStateChanged()new

Firebase 10 Sign In A User Account Using signInWithEmailAndPassword()new

Firebase 10 Sign Out A User Using signOut()new

Firebase 10 Get User Data From Cloud Firestore new

Firebase Version 8 Tutorial (Namespaced)

REAL-TIME DATABASE (RTDB)

Build A CRUD Web App With RTDB Part #1

Build A CRUD Web App With RTDB Part #2

Real-Time Database Querying, Sorting & Filtering

CLOUD FIRESTORE

Cloud Firestore Querying, Sorting & Filtering

Cloud Firestore Get Logged-in User Data

Cloud Firestore Partially Update A Document

SECURITY RULES (FIRESTORE)

5 Must-Know Security Rules Explained

CLOUD FUNCTIONS

Create Your First Cloud Function (HTTP Trigger)

Send Email Using Firebase Functions & Nodemailer

Add Subscriber To MailChimp Using Cloud Functions

VUE JS + FIREBASE

Create A Login Page Quickly Using FirebaseUI

Build A Complete To-Do Authentication App

Build A Restaurant Menu Page

Learn Role Based Authentication & Authorization

Create Stripe Checkout Payment Form

Track Users Location Real-Time

Deploy Vue.js App To Firebase Hosting

Remove Dev Mode Warning

Last modified on February 7th, 2026

Raja Tamil

825 views

0 Comments

Authentication Firebase Javascript

825

Firebase Authentication Crash Course 2026 (JavaScript) - YouTube

Tap to unmute

Firebase Authentication Crash Course 2026 (JavaScript) SoftAuthor

SoftAuthor2.12K subscribers

In this Firebase 10 (the latest version) Authentication tutorial, learn how to log out/sign out a user using the signOut() method.

The signOut() is one of the 4 important methods that the Firebase Authentication SDK offers to build a user authentication system in minutes.

  1. createUserWithUserNameAndPassword()
  2. onAuthStateChanged()
  3. signInWithEmailAndPassword()
  4. signOut() → you’re here

The signOut() method allows users to sign out or log out of their current authentication session by ending the validation of the user’s authentication token provided at the time of signing in.

1. Initialize Firebase SDK To Your Web App

Before going any further, I assume that you already know how to initialize Firebase SDK in your JavaScript web app.

I also assume that you already know how to sign in to a user account using the Firebase Authentication back-end.

2. Import getAuth & signOut Methods

Import the Firebase Authentication SDK library via either NPM or CDN (I use CDN in the below example) and destructure the getAuth() and signOut() methods.

import {
  getAuth,
  signOut,
} from "https://www.gstatic.com/firebasejs/10.0.0/firebase-auth.js";

JavaScript

Copy

In order to implement any of the Firebase Authentication methods, first we need to create an instance of an authentication object.

const auth = getAuth();

JavaScript

Copy

🚀 Want to build Firebase apps you can actually trust in production?

If you’re tired of piecing together tutorials and guessing about data modeling, authentication, and authorization, I’ve put the full system into a short course.

👉 View the Full-Stack Firebase Course

3. Create a Sign-Out Button

Typically, you will want to call the signOut() method when a user clicks the sign-out button to sign out their current authenticated session after successfully signing in.

<button id="signOutBtn">Sign out</button>

HTML

Copy

Next, create a DOM reference for the sign-out button element.

const signOutBtn = document.getElementById("signOutBtn");

JavaScript

Copy

Then attach a click event with the callback function signOutButtonPressed to the sign-up button.

const signOutButtonPressed = (e) => {
  e.preventDefault();
  console.log("Sign out Button Pressed");
}

signOutBtn.addEventListener("click", signOutButtonPressed);

JavaScript

Copy

4. Call signOut() Method

Inside the signOutButtonPressed function, call the signOut() method.

const signOutButtonPressed = (e) => {
  e.preventDefault();
  signOut();
};

JavaScript

Copy

The signOut() method takes a single argument which is the authentication object that I’ve declared above.

const signOutButtonPressed = (e) => {
  e.preventDefault();
  signOut(auth);
};

JavaScript

Copy

The signOut() method is an asynchronous method that returns a promise which can be either fulfilled or rejected.

So add the await/async keywords to it.

const signOutButtonPressed = async(e) => {
  e.preventDefault();
  await signOut(auth);
};

JavaScript

Copy

To capture any errors, wrap the signOut() method with a try-catch block.

try {
    await signOut(auth);
    console.log("User Signed Out Successfully!");
  } catch (error) {
    console.log(error.code);
  }

JavaScript

Copy

Disqus Recommendations

We were unable to load Disqus Recommendations. If you are a moderator please see our troubleshooting guide.

  • 8 months ago

In this FREE course, you're going to learn how to build a simple real-world …

  • 3 years ago

Learn how to use createUserWithEmailAndPassword() to create a new Firebase …

  • 3 years ago
  • 1 comment

The onAuthStateChanged() method is triggered when a user's authentication state …

  • 3 years ago

Learn how to get use data from firebase 9 Cloud Firestore database with 3 …

  • 4 months ago

Learn how to model Firestore data the right way for performance, cost, and …

  • 3 years ago

Learn how to authenticate a user account using the …

tempest.services.disqus.com

tempest.services.disqus.com is blocked

This page has been blocked by an extension

  • Try disabling your extensions.

ERR_BLOCKED_BY_CLIENT

Reload

This page has been blocked by an extension

Disqus Comments

We were unable to load Disqus. If you are a moderator please see our troubleshooting guide.

G

Start the discussion…

Comment

Log in with
or sign up with Disqus or pick a name

Disqus is a discussion network

  • Don't be a jerk or do anything illegal. Everything is easier that way.

Read full terms and conditions

This comment platform is hosted by Disqus, Inc. I authorize Disqus and its affiliates to:

  • Use, sell, and share my information to enable me to use its comment services and for marketing purposes, including cross-context behavioral advertising, as described in our Terms of Service and Privacy Policy, including supplementing that information with other data about me, such as my browsing and location data.
  • Contact me or enable others to contact me by email with offers for goods or services
  • Process any sensitive personal information that I submit in a comment. See our Privacy Policy for more information

Acknowledge I am 18 or older

Favoriting means this is a discussion worth sharing. It gets shared to your followers' Disqus feeds, and gives the creator kudos!

Find More Discussions

Share

  • Tweet this discussion

    • Share this discussion on Facebook
    • Share this discussion via email
    • Copy link to discussion
  • Best

Be the first to comment.

Load more comments

live.rezync.com

live.rezync.com is blocked

This page has been blocked by an extension

  • Try disabling your extensions.

ERR_BLOCKED_BY_CLIENT

Reload

This page has been blocked by an extension

pippio.com

pippio.com is blocked

This page has been blocked by an extension

  • Try disabling your extensions.

ERR_BLOCKED_BY_CLIENT

Reload

This page has been blocked by an extension

Twitter Widget Iframe