drekka
drekka

Reputation: 21883

Facebook auth token failing to create Firebase auth

I'm trying to sign into Firebase using this code to generate Firebase authentication credentials.

func signIn(fromViewController controller: UIViewController) -> Promise<AuthCredential> {

        return wrap { completion in
            self.loginManager.logIn(withReadPermissions: ["public_profile"],
                                    from: controller,
                                    handler:completion)
            }
            .then { result -> AuthCredential in

                if result.isCancelled {
                    throw NSError.cancelledError()
                }

                let token = result.token!
                return FacebookAuthProvider.credential(withAccessToken:token.tokenString)
        }
    }

And getting this error back.

ERROR Error Domain=FIRAuthErrorDomain Code=17999 "An internal error has occurred, print and inspect the error details for more information." UserInfo={error_name=ERROR_INTERNAL_ERROR, NSLocalizedDescription=An internal error has occurred, print and inspect the error details for more information., NSUnderlyingError=0x6040001cb050 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" 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\":\"CCGlFkNF1pl\"}}";
            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\":\"CCGlFkNF1pl\"}}";    
}}}}

I setup my app in the facebook developer area and cut and pasted the app id and secret key into the facebook auth setup in firebase. So I'm quite stuck at the moment as to what I might have done wrong.

Anyone encountered this problem?

Upvotes: 0

Views: 1091

Answers (1)

aofdev
aofdev

Reputation: 1812

have you enabled Facebook on Firebase console ?

In my advanced settings within the facebook app, I had turned on "Is App Secret embedded in the client ? "

Turning that off made it all work!!!!

enter image description here

Upvotes: 4

Related Questions