使用Firebase提供的API密钥无效
我正在使用Firebase身份validation,允许用户使用Facebook注册。 我已经采取了从这里开始的所有步骤来实现注册,包括将GoogleService-Info.plist添加到我的项目中。
我得到的Facebook权限屏幕一切正常,但当应用程序点击
FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in
返回此错误: 请求中提供了一个无效的API密钥。
任何人都可以帮助我吗?
谢谢
这是我使用Facebooklogin的function代码。
@IBAction func signUpWithFacebook() { let fbLogin = FBSDKLoginManager() fbLogin.logInWithReadPermissions(["email"], fromViewController:self, handler: { (result, error) -> Void in if ((error) != nil) { print("Process error") } else if (result.isCancelled) { print("Cancelled"); } else { print("Logged in"); let accessToken = FBSDKAccessToken.currentAccessToken().tokenString let credential = FIRFacebookAuthProvider.credentialWithAccessToken(accessToken) print(FBSDKAccessToken.currentAccessToken().tokenString) FIRAuth.auth()?.signInWithCredential(credential) { (user, error) in // ... if let user = user{ print(user.displayName) } else{ if let error = error { print(error.localizedDescription) } } } } }) }
解决它,为将来需要解决scheme的任何人。
有时API_KEY从GoogleService-Info.plist中丢失,需要添加。
API密钥可从Google API控制台https://console.developers.google.com/中find
您可以通过再次下载Firebase控制台上的“项目设置”部分下的“GoogleService-Info.plist”文件来解决此问题。
确保在新的“GoogleService-Info.plist”上设置了API_KEY。
- UIGraphicsBeginImageContext必须是视网膜感知?
- Swift尝试呈现其视图不在窗口层次结构中的UIAlertController(在TWTRShareEmailViewController之后呈现)
- 我可以在iPhone应用程序上使用Facebook身份validation服务器端stream程,并仍然有客户端的交互?
- 如何从一个使用firebase设置的IOS应用程序读取/写入另一个Firebase项目中包含的另一个Firebase数据库? Swift 3
- 需要Firebase重新validation
- Firebase身份validation – 获取提供商ID
- 将“全名”字段添加到Firebase电子邮件/密码身份validation?
- 应用程序内的Dropboxauthentication
- 如何获取ios中的twitter个人资料图片?
- 读取Firebase身份validation错误(Firebase 3.x和Swift)
- IOS相互authentication