【发布时间】:2018-01-06 06:24:57
【问题描述】:
我按照此处描述的步骤操作:https://firebase.google.com/docs/auth/admin/create-custom-tokens
我可以使用 Firebase Admin SDK 创建自定义令牌。
我将它们发送回客户端 iOS 应用程序以像这样使用:
Auth.auth().signIn(withCustomToken: customToken ?? "") { (user, error) in
// ...
}
但我收到此错误:
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}
我正在使用 Firebase Admin 5.2.0 和 Firebase iOS 客户端 4.0.0
有什么想法吗?
【问题讨论】:
-
查看这篇文章以了解如何调试它:stackoverflow.com/questions/45110441/… 请记住,自定义令牌的生命周期是有限的,如果您存储和重用它,它可能会过期。
-
如果它已过期,我已经设法请求更新,但我的问题是令牌永远无法工作
-
好的,想把它排除在外。检查该链接中描述的自定义令牌的解码格式。
-
@bojeil 使用调试器 jwt.io 使用正确的数据正确解码令牌
-
确保客户端项目与生成该自定义令牌的服务帐户匹配。尝试使用 REST API 发送令牌:firebase.google.com/docs/reference/rest/auth/… 如果这没有帮助,您应该联系 Firebase 支持。
标签: firebase firebase-authentication