Firebaseui-ios: Problem with Facebook Login: Unsuccessful debug_token response from Facebook: - The App_id in the input_token did not match the Viewing App

Created on 11 Nov 2018  Â·  4Comments  Â·  Source: firebase/FirebaseUI-iOS

Swift
iOS 12.1
Using Firebase (5.12.0)
Using FirebaseAuth (5.0.5)
Using FirebaseAuthInterop (1.0.0)
Using FirebaseCore (5.1.7)
Using FirebaseUI (5.2.2)
Using FBSDKCoreKit (4.38.1)
Using FBSDKLoginKit (4.38.1)
cocoapods-1.5.3

I've followed these two guides carefully:

https://firebase.google.com/docs/auth/ios/firebaseui?authuser=1
and
https://github.com/firebase/FirebaseUI-iOS/blob/master/FirebaseAuthUI/README.md

But they seem to differ on one key step:

The github guide says I should use:

func authUI(_ authUI: FUIAuth, didSignInWithAuthDataResult authDataResult: AuthDataResult?, error: Error?) { // handle user (authDataResult.user) and error as necessary }

While the Firebase guide asks for:
After you present the authentication view and the user signs in, the result is returned to the FirebaseUI Auth delegate in the didSignInWithUser:error: method:
SwiftObjective-C

func authUI(_ authUI: FUIAuth, didSignInWith user: FIRUser?, error: Error?) { // handle user and error as necessary }

Xcode gives me errors while suing didSignWithAuthDataResult, so I either have to add @noobjc (which causes the method to never be called) or @objc(authUI:didSignInWithAuthDataResult:error:) func authUI(_ authUI: FUIAuth, didSignInWith authDataResult: AuthDataResult?, error: Error?) { (which ends up in an error similar to using disSignInWithUser as seen below)

When I use didSignInWithUser I get the following error after logging into Facebook:

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

with this full error description:

Printing description of error:
â–¿ Optional<Error>
  - some : 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=0x600000b051d0 {Error Domain=FIRAuthInternalErrorDomain Code=3 "(null)" UserInfo={FIRAuthErrorUserInfoDeserializedResponseKey={
    code = 400;
    errors =     (
                {
            domain = global;
            message = "Unsuccessful debug_token response from Facebook: {\"error\":{\"message\":\"(#100) The App_id in the input_token did not match the Viewing App\",\"type\":\"OAuthException\",\"code\":100,\"fbtrace_id\":\"FrWC0+oiUWC\"}}";
            reason = invalid;
        }
    );
    message = "Unsuccessful debug_token response from Facebook: {\"error\":{\"message\":\"(#100) The App_id in the input_token did not match the Viewing App\",\"type\":\"OAuthException\",\"code\":100,\"fbtrace_id\":\"FrWC0+oiUWC\"}}";
}}}}

Also this method is never called.

`func application(_ app: UIApplication, open url: URL,
                     options: [UIApplicationOpenURLOptionsKey : Any]) -> Bool {
        let sourceApplication = options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String?
        if FUIAuth(uiWith: Firebase.auth())?.handleOpen(url, sourceApplication: sourceApplication) ?? false {
            return true
        }
        // other URL handling goes here.
        return false
    }

What can be causing this problem?

Also, if I cannot manage to get this working with Firebase UI, can I implement Facebook login manually with Firebase but use Firebase UI Auth for all the other authentication mentods?

Most helpful comment

For anyone running into this issue in the future the problem is an internal Expo issue that is references here

All 4 comments

Note that email signup works fine and I'm not calling the default Auth UI because it looks for GoogleService-Info.plist whereas I have to plist files, one for Development and the other for Production. So, here's the code I use:

`let authUI = FUIAuth(uiWith: Firebase.auth())
guard let _ = authUI else {
return
}
authUI?.delegate = self

    let providers: [FUIAuthProvider] = [
        FUIFacebookAuth()
    ]

    authUI!.providers = providers

    let authViewController = authUI!.authViewController()
    present(authViewController, animated: true, completion: nil)`

The singleton Firebase, calls these:

`@objc static func app() -> FirebaseApp {
return FirebaseApp.app(name: environment.rawValue)!
}

@objc static func auth() -> Auth {
    return Auth.auth(app: app())
}`

The GitHub guide is more recent, but both should work. The one on the Firebase site just references a deprecated method.

Are you able to integrate Facebook manually? The debug token issue shouldn't be a FirebaseUI-specific issue.

Thank you. The problem was with the wrong Facebook app id.

For anyone running into this issue in the future the problem is an internal Expo issue that is references here

Was this page helpful?
0 / 5 - 0 ratings

Related issues

rodrigosol picture rodrigosol  Â·  3Comments

platoputhur picture platoputhur  Â·  4Comments

yarodevuci picture yarodevuci  Â·  9Comments

Vortec4800 picture Vortec4800  Â·  5Comments

alfongj picture alfongj  Â·  7Comments