2
votes

I am trying to authenticate my login with Firebase 2 without using FBSDKLoginButton. I used the FBSDKLoginManager to get my FB Login token, then when i try to authenticate that with Firebase i get the following error:

Error Domain=FIRAuthErrorDomain Code=17023 "An invalid API Key was supplied in the request." UserInfo={NSLocalizedDescription=An invalid API Key was supplied in the request., 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);
                }
            })
        }
    }

I have all the info set in the 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>

I also checked the API from the facebook app and it matches 100%. I am really clueless why its not working.

Thank you in advance.

1

1 Answers

8
votes

The problem is from the google-services-plist. Its missing the API_KEY, you will need to add that and get the API from google api console.

The API Key can be found from Google API Console https://console.developers.google.com/