Stay organized with collections
Save and categorize content based on your preferences.
Signing in users with a custom authentication system
This document shows you how to use Identity Platform to sign in users with a custom authentication system. In custom authentication, you use an authentication server to produce custom signed tokens when a user successfully signs in. Your app receives this token and uses it to authenticate with Identity Platform.
import{getAuth,signInWithCustomToken}from"firebase/auth";constauth=getAuth();signInWithCustomToken(auth,token).then((userCredential)=>{// Signed inconstuser=userCredential.user;// ...}).catch((error)=>{consterrorCode=error.code;consterrorMessage=error.message;// ...});
firebase.auth().signInWithCustomToken(token).then((userCredential)=>{// Signed invaruser=userCredential.user;// ...}).catch((error)=>{varerrorCode=error.code;varerrorMessage=error.message;// ...});
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-04-02 UTC."],[[["This guide details how to use Identity Platform for user sign-in with a custom authentication system, leveraging custom signed tokens generated by your authentication server."],["Before implementing custom authentication, you should consider migrating users if Identity Platform natively supports your app's sign-in method."],["The sign-in process involves collecting user credentials, sending them to your server for validation, receiving a custom JWT, and then using `signInWithCustomToken()` to authenticate the user with Identity Platform."],["To begin, you will need to install the client SDK and ensure that your server can accept user credentials and mint custom tokens."],["Once the user is signed in, you can then configure custom claims and integrate Identity Platform using the REST API."]]],[]]