skip to Main Content

I’m trying to get working Facebook authentification in my app.

I’m following instructions here : https://firebase.google.com/docs/auth/ios/facebook-login

When I clicked on the Facebook login button, everything is working fine : the user is logged. In the facebook login delegate method, it is ok :

    func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!)

In this method, I have to create a Firebase token to authenticate finally with Firebase (step 5). This is what I do :

let credential = FacebookAuthProvider.credential(withAccessToken: 
FBSDKAccessToken.current().tokenString)
            Auth.auth().signIn(with: credential) { (user, error) in
                if let error = error {
                    print(error.localizedDescription)
                    self.errorServer()
                } else {
                    FitUtils.setFitUser(user: user)
                }
            }

The problem : My credential variable is not nil, everything is working, but when i’m calling Auth.auth().signIn(...), the method throwns the error variable, and user is nil.

I don’t have many information about the error :

An internal error has occurred, print and inspect the error details
for more information.

And

error   NSError domain: "FIRAuthErrorDomain" - code: 17999  0x0000604000640630

I suspect an error about the Facebook API key or something like that in the Firebase console, but I already checked everything is fine.

Any idea ?

EDIT

I found an explicit description of the error :

UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
    code = 400;
    errors =     (
                {
            domain = global;
            message = "Unsuccessful debug_token response from Facebook: {"error":{"message":"(#100) You must provide an app access token or a user access token that is an owner or developer of the app","type":"OAuthException","code":100,"fbtrace_id":"GkGVPPBP7vo"}}";
            reason = invalid;
        }
    );
    message = "Unsuccessful debug_token response from Facebook: {"error":{"message":"(#100) You must provide an app access token or a user access token that is an owner or developer of the app","type":"OAuthException","code":100,"fbtrace_id":"GkGVPPBP7vo"}}";
}}}}
(lldb) 

4

Answers


  1. Chosen as BEST ANSWER

    Finally found an answer thanks to this post :

    https://github.com/firebase/FirebaseUI-iOS/issues/83#issuecomment-232523935

    I have to disable the option "Is App Secret embedded in the client?" in the Facebook console :

    enter image description here

    Hope this helps.


  2. On the Facebook Developer site, navigate to:

    Settings > Advanced > Security > Require App Secret

    Set to YES.

    Fixed it for me.

    Login or Signup to reply.
  3. The following worked for me:

    Go to android/app/src/main/res/values/strings.xml. Make sure you have the following line in your <resources>:

    <string name="facebook_app_id">FACEBOOK*APP*ID</string>
    

    where FACEBOOK*APP*ID is the your app ID from developers.facebook.com/apps

    Login or Signup to reply.
  4. In my case, there was set wrong App secret in Firebase 🤷🏻‍♂️

    1. Go to the Firebase console and choose the project.
    2. Under Project shortcuts choose Authentication.
    3. Select Sign-in method tab.
    4. In Sign-in providers click on Facebook to edit.
    5. Set the correct App secret from your Facebook app.
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search