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;// ...});
[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-05-29 (世界標準時間)。"],[[["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."]]],[]]