skip to Main Content

I implement Login to Facebook using Firebase Auth in my android app using custom layout. It gives Developer error after Facebook upgrade graph API from 3.2 to 4.4. I follow the complete procedure .Create project to Firebase and Facebook developer console . enable Facebook login in Firebase authentication , add app id and app secret to Firebase . get oath URL and add to Facebook console. Also generate Openssl SHA for Facebook and add in it. here is my dependencies :

implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.google.firebase:firebase-core:16.0.9'
implementation 'com.google.firebase:firebase-auth:17.0.0'
implementation 'com.firebaseui:firebase-ui-database:4.3.1'
implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
implementation "com.google.android.gms:play-services-auth:17.0.0"

this is code i did:

 AuthMethodPickerLayout customLayout = new AuthMethodPickerLayout
                .Builder(R.layout.activity_main)
                .setGoogleButtonId(R.id.ll_google)
                .setFacebookButtonId(R.id.ll_facebook)
                .setEmailButtonId(R.id.ll_email)
                // ...
                //.setTosAndPrivacyPolicyId(R.id.baz)

                .build();
        // Choose authentication providers
        List<AuthUI.IdpConfig> providers = Arrays.asList(
                new AuthUI.IdpConfig.EmailBuilder().build(),
                new AuthUI.IdpConfig.GoogleBuilder().build(),
                new AuthUI.IdpConfig.FacebookBuilder().build());


        AuthUI.getInstance()
                .createSignInIntentBuilder()
                .setIsSmartLockEnabled(false)
                .setLogo(R.drawable.icon)
                .setAuthMethodPickerLayout(customLayout)
                .setTosAndPrivacyPolicyUrls("https://mybrandfitness.com/terms-conditions",
                        "https://mybrandfitness.com/privacy-policy")
                .build();

llFacebook.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                AuthUI.IdpConfig facebookIdp = new AuthUI.IdpConfig.FacebookBuilder()
                        .setPermissions(Arrays.asList("email", "public_profile"))
                        .build();

                startActivityForResult(
                        AuthUI.getInstance()
                                .createSignInIntentBuilder()
                                .setAvailableProviders(Arrays.asList(facebookIdp))
                                .build(),
                        RC_SIGN_IN);
            }
        });

it gives me following error:

E/AuthUI: A sign-in error occurred.
com.firebase.ui.auth.FirebaseUiException: Developer error
    at com.firebase.ui.auth.util.data.ProviderUtils$1.then(ProviderUtils.java:219)
    at com.firebase.ui.auth.util.data.ProviderUtils$1.then(ProviderUtils.java:195)
    at com.google.android.gms.tasks.zzf.run(Unknown Source)
    at android.os.Handler.handleCallback(Handler.java:739)
    at android.os.Handler.dispatchMessage(Handler.java:95)
    at android.os.Looper.loop(Looper.java:145)
    at android.app.ActivityThread.main(ActivityThread.java:5951)
    at java.lang.reflect.Method.invoke(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:372)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)

any suggestion will be appreciated ..thank you

2

Answers


  1. First, open the ProviderUtils.java:219 and you will see that the login was successful, but it raised exception for the case: There is an existing user who only has unsupported sign in methods.

    if (task.isSuccessful() && lastSignedInProviders.isEmpty()
                                && !methods.isEmpty()) {
                            // There is an existing user who only has unsupported sign in methods
                            return Tasks.forException(new FirebaseUiException(ErrorCodes
                                    .DEVELOPER_ERROR));
                        }
    

    So, i guess that the email (of your facebook account) you’re using to signing was used to login into your app before with other login method, ex: user and password.

    • Try with other facebook account to see if it works
    • Delete the account with that email and try again
    Login or Signup to reply.
  2. In my case i have logged into firebase with an email and i was using the same email for facebook that created the issue . i deleted the entry of email from firebase console and that worked like magic.also don’t forget to add SHA1 to the firebase

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search