代码=17000 "自定义令牌格式不正确。请检查文档。"

Mon*_*nta 5 firebase firebase-authentication

我按照此处描述的步骤操作:https : //firebase.google.com/docs/auth/admin/create-custom-tokens

我可以使用 Firebase Admin SDK 创建自定义令牌。

我将它们发送回客户端 iOS 应用程序使用如下:

Auth.auth().signIn(withCustomToken: customToken ?? "") { (user, error) in
  // ...
}
Run Code Online (Sandbox Code Playgroud)

但我收到此错误:

Code=17000 "The custom token format is incorrect. Please check the documentation." UserInfo={NSLocalizedDescription=The custom token format is incorrect. Please check the documentation., error_name=ERROR_INVALID_CUSTOM_TOKEN}
Run Code Online (Sandbox Code Playgroud)

我正在使用 Firebase Admin 5.2.0 和 Firebase iOS 客户端 4.0.0

任何的想法?

小智 0

我尝试了很多时间来解决它..并且我发现了一些有趣的事情。custom_toke 以“%3D%3D”结尾,这不是有效的,您需要将其替换为“==”..并且它会正常工作。