FirebaseUI authentication with Facebook does not work

advertisements

I am using FirebaseUI-Authentication. Signing in with an email or a Google account is successful, but sign in with Facebook doesn't work. onActivityResult() is not called after AuthUI activity was started and attempted to sign in with Facebook. After sign in attempt the app is stuck at the loading window. logcat outputs a FirebaseApp log:

Notifying background state change listeners.

On the Facebook app dashboard I set the Valid OAuth redirect URI, as the firebase guide stated, and I set the app public (does it matter if it is public or in development state?). In the Firebase console I enabled Facebook login and set the App ID and the App secret.

This is a video recording showing what happens after sign in with Facebook is clicked on the sign in activity.

Why isn't onActivityResult() called?

MainActivity:

/**
 * Use this method to start the FirebaseUI sign in activity.
 */
public void switchToSignIn() {
    this.activity.startActivityForResult(
            AuthUI.getInstance()
                    .createSignInIntentBuilder()
                    .setProviders(
                            AuthUI.EMAIL_PROVIDER,
                            AuthUI.GOOGLE_PROVIDER,
                            AuthUI.FACEBOOK_PROVIDER)
                    .build(), RC_SIGN_IN);
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == RC_SIGN_IN) {
        if (resultCode == this.activity.RESULT_OK) {
            // user is signed in!
            Log.d(Constants.TAG_LoginHandler, "Sign in result: RESULT_OK");
            logUserInfo();
            tryAccessMainFragment();
        } else {
            Log.d(Constants.TAG_LoginHandler, "Sign in result: RESULT_CANCELLED");
            // user is not signed in. Maybe just wait for the user to press
            // "sign in" again, or show a message
        }
    }
}

build.gradle:

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:support-v4:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.firebaseui:firebase-ui:0.4.0'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'de.hdodenhof:circleimageview:1.3.0'
}

apply plugin: 'com.google.gms.google-services'


If you are using FirebaseUI, you must put this exact string in strings.xml:

<string name="facebook_application_id" translatable="false">APPID</string>

The APPID can be found on your developers.facebook.com dashboard.

See firebaseui-auth readme

Also be sure to add your android key hash and OAuth firebase URL in the facebook app.