WorkOS Docs Homepage


Add Single Sign-On to your Firebase application with WorkOS.

In this guide, you’ll learn how to use WorkOS to add Single Sign-On (SSO) to a Firebase app. We will use the logic in an existing WorkOS callback route to create a custom token and sign a user in with Firebase.

This guide uses the WorkOS and Firebase Node.js SDKs, for support with a different SDK please reach out to [email protected]

To get the most out of this guide, you should:

Ensure the Firebase SDK and Firebase Admin SDK have been added to your application.

First, install the Firebase SDKs in the project directory:


Second, initialize your Firebase admin app.

Initialize Firebase in your application

In this guide we will use the IdP ID as the Firebase UID. Please use whatever UID best meets the needs of your application.

In the SSO setup guide you added a callback endpoint to call getProfileAndToken. The profile returned will have unique identifier for the user, assigned by the Identity Provider called the idp_id. We will use this to generate a custom JWT with Firebase.

Extract the IdP ID from the user Profile

In this step we will add onto the previous logic to create the Firebase custom JWT.

You will use the createCustomToken(uid) method from the Firebase Admin SDK, with the IdP ID as the uid.

Once the token in created you will use the signInWithCustomToken(auth, customToken) method from the firebase/auth SDK to authenticate the user.

Create a custom Firebase JWT and authenticate the user

Now that the user is signed in, you can use Firebase to manage users and sessions.

Now that you’ve authenticated the user, you can update their Firebase profile with attributes in the profile returned from WorkOS.

Update Firebase Profile

You now have a Firebase user that is signed in and updated with SAML attributes.