我尝试使用新的Firebase平台进行Facebook登录。
这是facebook登录的代码
let facebookLogin = FBSDKLoginManager()
facebookLogin.logInWithReadPermissions(["email"], fromViewController: self) { (result, error) -> Void in
if error != nil {
print("error is \(error)")
} else {
let accessToken = FBSDKAccessToken.currentAccessToken().tokenString
let credential = FIRFacebookAuthProvider.credentialWithAccessToken(accessToken)
AUTH?.signInWithCredential(credential, completion: { (user, error) -> Void in
if error != nil {
print("error is \(error)")
} else {
print(user)
NSUserDefaults.standardUserDefaults().setValue(user?.uid, forKey: KEY_UID)
self.performSegueWithIdentifier(SEGUE_LOGGEDIN, sender: nil)
}
})
}
这是我得到的错误代码
可选(错误域= FIRAuthErrorDomain代码= 17999"发生内部错误,打印并检查错误详细信息以获取更多信息。" UserInfo = {error_name = ERROR_INTERNAL_ERROR,NSUnderlyingError = 0x79f082b0 {错误域= FIRAuthInternalErrorDomain Code = 3"(null)" UserInfo = {FIRAuthErrorUserInfoDeserializedResponseKey = {type = immutable dict,count = 3, entries =>
0:{contents ="错误"} = {type = immutable,count = 1,values =(
0:{type = immutable dict,count = 3, entries =>
0:{contents =" reason"} = {contents =" invalid"}
1:{contents =" message"} = {contents ="来自Facebook的不成功的debug_token响应:{"错误":{"消息" :"无效的OAuth访问令牌签名。","键入":" OAuthException","代码":190," fbtrace_id& #34;:" BrewfOSy / FH"}}"}
2:{contents =" domain"} = {contents =" global"} }
)}
1:{contents =" code"} = {value = +400,type = kCFNumberSInt64Type}
2:{contents =" message"} = {contents ="来自Facebook的不成功的debug_token响应:{"错误":{" message" :"无效的OAuth访问令牌签名。","键入":" OAuthException","代码":190," fbtrace_id& #34;:" BrewfOSy / FH"}}"}
}
}},NSLocalizedDescription =发生内部错误,打印并检查错误详细信息以获取更多信息。})
答案 0 :(得分:5)
确保在firebase控制台中启用Facebook身份验证。
确保在firebase控制台中输入正确的FACEBOOK App ID和App Secret。 (不是您的XCode App ID)
答案 1 :(得分:-4)
//使用Firebase进行身份验证
FIRAuth.auth()?。signInWithCredential(credential){(user,error)in
当我使用GoogleSignIn时,还会返回相同的错误代码“FIRAuthErrorDomain”。 文档中没有“FIRAuthErrorDomain”的描述。