Firebase Sign in with a pre-built UI Facebook login not working; Shows Login Error: There is an error in logging you into this application

Viewed 1445

I'm using Firebase's "Sign in with pre built UI" feature for signin with Google & Facebook account. Google account works fine. When I try to use the facebook account option,

  1. Device with no facebook app installed : A popup window for login to facebook opens, after login, authorization for my facebook app is shown, when I authorize fb app to use my account details, pop up windows is closed and firebase login UI page is shown again. An indefinite progressbar is shown in this stage and it keeps on going, nothing happens.

  2. Device with facebook app installed: Facebook app is opened and it DOES NOT show authorization prompt. Instead shows "Login error: There is an error in logging you into this application"

So far I have done the following

  • Enabled facebook login in my firebase console

  • Entered app id and app secret

  • Entered OAuth redirection from firebase console in fb app settings

  • Added dependencies for both firebase, facebook sdk in app

  • Added

<string name="facebook_application_id" translatable="false">YOUR_APP_ID</string>
<string name="facebook_login_protocol_scheme" translatable="false">fbYOUR_APP_ID</string> 

in strings.xml

  • Entered correct debug and release key hashes in fb app settings

  • Entere correct package name in fb app settings

  • Client OAuth Login, Web OAuth Login, Enforce HTTPS, Embedded Browser OAuth Login, Use Strict Mode for Redirect URIs - Turned ON in fb app settings

  • App status is LIVE

Some code:

Dependencies

implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.facebook.android:facebook-android-sdk:[5,6)'

Login UI Invocation

btnSignIn.onClick {
            startActivityForResult(
                AuthUI.getInstance()
                    .createSignInIntentBuilder()
                    .setIsSmartLockEnabled(false)
                    .setAvailableProviders(
                        arrayListOf(
                            AuthUI.IdpConfig.FacebookBuilder().build(),
                            AuthUI.IdpConfig.GoogleBuilder().build()
                        )
                    ).setLogo(R.mipmap.ic_launcher)
                    .build(),
                RC_FIREBASE_SIGN_IN
            )
        }

Google sigin shows the indefinite progress bar for a while and returns to the page with above code and everything works as expected. Fb signin won't return from the firebase ui. Why isn't fb login working? Am I missing something here or did something wrong?

2 Answers

I have already answered a similar question, hence I will share the same answer. Hope this solves the issue.

Alternatively, if you haven't added the SHA1 values to the firebase console, please follow this

Related