WorkOS Docs Homepage
Migrations

Migrate from Firebase

Learn how to migrate users to WorkOS from Firebase.

The WorkOS User Management API allows you to migrate your existing user data from a variety of existing sources. In this guide, we’ll walk through the steps to export your users from Firebase, and then import them into WorkOS.

Firebase customers can export their user data using either the Firebase CLI or the Firebase API. In this guide we’ll be using the Firebase CLI, use the following command to retrieve a dump of all users in JSON or CSV format.

Exporting users with the Firebase CLI

After obtaining your user data from Firebase, it’s time to import it into WorkOS, mapping attributes from the Firebase User format to WorkOS API parameters.

Using the WorkOS Create User API, you can create a corresponding record in WorkOS for each exported user. Use the following mapping from the Firebase format to parameters in your WorkOS Create User API calls:

FirebaseWorkOS API
emailemail
emailVerifiedemail_verified
displayNamefirst_name
displayNamelast_name

If your users sign in to your Firebase application using passwords, you can choose to also import those password hashes. Firebase uses a forked version of scrypt which can be directly imported during the user creation process into WorkOS, or later using the Update User API.

First, retrieve your Firebase project’s password hash parameters from the Firebase console following the export documentation. These parameters are the base64_signer_key, base64_salt_separator, rounds, and mem_cost.

Next, retrieve the password salts and hashes for each of your individual Firebase users by running the Firebase CLI auth:export command. Your Firebase users that have a password set will have a passwordHash and salt field present which will be imported into WorkOS.

Finally, you will need to format these parameters into a PHC-compatible password hash following this Firebase to PHC hash parameter mapping:

Firebase valuePHC hash parameter
base64_signer_keysk
base64_salt_separatorss
roundsr
mem_costm

The hash, salt, along with sk and ss parameters, should be B64 encoded, which means trimming the = characters that represent base64 padding. Using a PHC-formatting library, like @phc/format for Node, should handle this for you.

Import Firebase password hash
JavaScript

Firebase authentication methods vary depending on your specific usage, and corresponding connections can be easily configured in WorkOS. This allows users to continue signing in with the same authentication methods, matching the previous sign in experience.

If your users “Sign in with Google” or similar, you can configure WorkOS to continue using those sign in methods. Migrating these connections involves providing the same client credentials (i.e. Client ID and Client Secret) to WorkOS as configured in Firebase.

For more details on supported connections, see the provider-specific integration guides, such as for Microsoft and Google.

Reach out to support@workos.com if there are additional Social Auth providers you would like to see supported.

If your users sign in using Email Link, sometimes called “passwordless”, you can achieve the same experience by adding WorkOS Magic Auth to your application.

Enterprise authentication often uses standard protocols such as OpenID Connect (OIDC) or SAML between your service and identity provider.

The same identity providers can be configured in WorkOS, preserving the sign in process familiar to your users. For specific instructions, see the guides on setting up OIDC and SAML connections with WorkOS.