我正在尝试使用 Firebase SDK
向我的应用添加 VK 授权。
当用户授权完成后,我尝试将 token 传递给 Firebase。
func vkSdkAccessAuthorizationFinishedWithResult(result: VKAuthorizationResult!){
let tokenString = result.token.description
FIRAuth.auth()?.signInWithCustomToken(tokenString) { (user, error) in
// ...
}
}
Error: [1] (null) "NSLocalizedDescription" : "The custom token format is incorrect. Please check the documentation."
我可以在不运行服务器的情况下使用带有自定义身份验证的 Firebase 吗?
最佳答案
来自 Firebase 文档。 Create custom tokens using the Firebase SDK ,
我会说你需要为此使用 createCustomToken()
方法..你不能使用你的 VK 服务器 token 通过 firebase 登录......你需要为 firebase 生成 token createCustomToken()
方法。
var uid = "some-uid";
var customToken = firebase.auth().createCustomToken(uid);
希望这对你有用
关于ios - Firebase 身份验证自定义 token iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38409082/