尝试让Facebook登录以使用新的Firebase,但我一直收到此错误:"请求中提供了无效的API密钥。"
facebookLogin.logInWithReadPermissions(["public_profile", "email", "user_friends"], fromViewController: self) { (login, error) in
if error != nil {
print("Facebook login failed. Error \(error)")
} else if login.isCancelled {
print("Facebook login was cancelled.")
} else {
let accessToken = FBSDKAccessToken.currentAccessToken().tokenString
let credential = FIRFacebookAuthProvider.credentialWithAccessToken(accessToken)
if let user = FIRAuth.auth()?.currentUser {
user.linkWithCredential(credential) { (sup, error) in
if let error = error {
print(error.localizedDescription)
return
}
}
} else {
FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in
if let error = error {
// ERROR COMING FROM HERE
print(error.localizedDescription)
return
}
}
}
}
}
答案 0 :(得分:2)
按照Google的说明:https://support.google.com/cloud/answer/6158862?hl=en获取或创建iOS应用的API KEY。
然后您需要抓住 API KEY 并将其放在 GoogleService-Info.plist 中作为:
密钥: API_KEY
值:您获得的api密钥。