2016-05-24 145 views
-1

試圖讓Facebook登錄與新的Firebase一起使用,但我一直收到此錯誤消息:「請求中提供了無效的API密鑰。」Firebase Facebook登錄:請求中提供了無效的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 
        } 
       } 
      } 
     } 
    } 

回答