如何使用自定义令牌登录创建FIRUser?

时间:2016-05-24 00:58:56

标签: ios swift facebook firebase firebase-authentication

我在Swift编程语言中使用iOS!

  • 我正在使用Firebase作为我的后端内容

  • 我正在使用Facebook帐户套件登录。

    • 我正在获取帐户套件访问令牌

所以我基本上使用帐户套件访问令牌

FIRAuth.auth()?.signInWithCustomToken(accessToken.tokenString, completion: { (user, error) in
        print(user)
        print("\n\n\n\(error)")
    })

我在控制台中收到错误

“错误域= FIRAuthErrorDomain代码= 17000”自定义令牌格式不正确。请查看文档。“UserInfo = {NSLocalizedDescription =自定义令牌格式不正确。请查看文档。,error_name = ERROR_INVALID_CUSTOM_TOKEN})”

引用Firebase click here!

1 个答案:

答案 0 :(得分:0)

尝试使用

FIRFacebookAuthProvider.credentialWithAccessToken(accessToken.tokenString)

后跟带凭证的signInWithCredential。

https://firebase.google.com/docs/auth/ios/facebook-login#authenticate_with_firebase