2016-05-30 20 views
2

我想使用Firebase 2進行身份驗證,而不使用FBSDKLoginButton進行身份驗證。我用FBSDKLoginManager讓我的FB登錄令牌,然後當我嘗試驗證與火力地堡我得到以下錯誤:Firebase2使用iOS Swift進行Facebook身份驗證(不含FBSDKLoginButton)

錯誤域= FIRAuthErrorDomain代碼= 17023「無效的API密鑰的請求提供」的UserInfo = {。NSLocalizedDescription =無效的API密鑰請求時,供給ERROR_NAME = ERROR_INVALID_API_KEY}

 let mngr = FBSDKLoginManager(); 
    mngr.logInWithReadPermissions(["email"], fromViewController: self) { (result, error) in 
     if FBSDKAccessToken.currentAccessToken() != nil { 
      let credential = FIRFacebookAuthProvider.credentialWithAccessToken(FBSDKAccessToken.currentAccessToken().tokenString); 

      FIRAuth.auth()?.signInWithCredential(credential, completion: { (user, error) in 
       if error == nil { 
        print("user: \(user?.displayName)"); 
       } else { 
        print(error.debugDescription); 
       } 
      }) 
     } 
    } 

我把所有的信息在plist中設置:

<string>VegFru</string> 
<key>LSApplicationQueriesSchemes</key> 
<array> 
    <string>fbauth2</string> 
    <string>fbapi</string> 
    <string>fb-messenger-api</string> 
    <string>fbshareextension</string> 
    <string>fbapi20130214</string> 
    <string>fbapi20130410</string> 
    <string>fbapi20130702</string> 
    <string>fbapi20131010</string> 
    <string>fbapi20131219</string> 
    <string>fbapi20140410</string> 
    <string>fbapi20140116</string> 
    <string>fbapi20150313</string> 
    <string>fbapi20150629</string> 
    <string>fbapi20160328</string> 
    <string>fbauth</string> 
    <string>fb-messenger-api20140430</string> 
    <string>fb-messenger-platform-20150128</string> 
    <string>fb-messenger-platform-20150218</string> 
    <string>fb-messenger-platform-20150305</string> 
</array> 

我也查了API從Facebook應用程序,它匹配100%。我真的無能爲力,爲什麼它不工作。

預先感謝您。

回答