FirebaseUI authentication with Facebook not logged in (Allowed)

I am using FirebaseUI Auth in Android to authenticate users.

Dependencies in my build.gradle app for Facebook login:

compile 'com.google.firebase:firebase-auth:11.0.0'
compile 'com.firebaseui:firebase-ui-auth:2.0.0'
compile 'com.facebook.android:facebook-android-sdk:[4,5)'

      

The class dependencies in my build.gradle project:

classpath 'com.google.gms:google-services:3.1.0'

      

My FirebaseUI authentication code in my onCreate () activity:

        final AuthUI.IdpConfig facebookIdp = new AuthUI.IdpConfig.Builder(AuthUI.FACEBOOK_PROVIDER)
                .setPermissions(Arrays.asList("email", "public_profile"))
                .build();

        mAuthChangeListener = new FirebaseAuth.AuthStateListener() {
            @Override
            public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
                FirebaseUser firebaseUser = firebaseAuth.getCurrentUser();

                if (firebaseUser != null) {
                    onSignedInInitialize(firebaseUser.getDisplayName());
                } else {
                    onSignedOutCleanUp();
                    startActivityForResult(
                            AuthUI.getInstance()
                                    .createSignInIntentBuilder()
                                    .setLogo(R.drawable.logo)
                                    .setTheme(R.style.LoginTheme)
                                    .setIsSmartLockEnabled(false)
                                    .setAvailableProviders(
                                            Arrays.asList(
                                                    new AuthUI.IdpConfig.Builder(AuthUI.GOOGLE_PROVIDER).build(),
                                                    facebookIdp,
                                                    new AuthUI.IdpConfig.Builder(AuthUI.EMAIL_PROVIDER).build()))
                                    .build(),
                            RC_SIGN_IN);
                }
            }
        };

      

My callback method in the same activity:

@Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == RC_SIGN_IN) {
            if (resultCode == RESULT_OK) {
                Toast.makeText(MainActivity.this, "Signed In!", Toast.LENGTH_SHORT).show();
            } else if (resultCode == RESULT_CANCELED) {
                Toast.makeText(MainActivity.this, "Signing cancelled!", Toast.LENGTH_SHORT).show();
                finish();
            }
        }
    }

      

And my .xml lines:

<string name="facebook_app_id">xxxxxxxxxxxxxxx</string>
<string name="fb_login_protocol_scheme">fbxxxxxxxxxxxxxxx</string>

      

And of course, I added all the necessary details to the Firebase Developer Console and Facebook Developer Console.

But when I click the Login with Facebook button , the facebook icon uploader appears for a few seconds and nothing happens. He is still on the same screen.

My data in logcat:

06-13 15:59:23.298 23599-26149/com.google.firebase.udacity.friendlychat D/FA: Logging event (FE): user_engagement(_e), Bundle[{firebase_event_origin(_o)=auto, engagement_time_msec(_et)=48262, firebase_screen_class(_sc)=AuthMethodPickerActivity, firebase_screen_id(_si)=-3048364835412835803}]
06-13 15:59:23.352 23599-26149/com.google.firebase.udacity.friendlychat D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=AuthMethodPickerActivity, firebase_previous_id(_pi)=-3048364835412835803, firebase_screen_class(_sc)=FacebookActivity, firebase_screen_id(_si)=-3048364835412835801}]
06-13 15:59:23.381 23599-26149/com.google.firebase.udacity.friendlychat D/FA: Connected to remote service
06-13 15:59:24.171 23599-23599/com.google.firebase.udacity.friendlychat E/FacebookProvider: Error logging in with Facebook. SERVER_ERROR: [code] 1675030 [message]: Error performing query. [extra]: Errors while executing operation "ProxyAuthAppLoginStartQuery": At Query.proxy_auth_app_login_start: Failed to resolve field.
06-13 15:59:24.194 23599-26149/com.google.firebase.udacity.friendlychat D/FA: Logging event (FE): screen_view(_vs), Bundle[{firebase_event_origin(_o)=auto, firebase_previous_class(_pc)=FacebookActivity, firebase_previous_id(_pi)=-3048364835412835801, firebase_screen_class(_sc)=AuthMethodPickerActivity, firebase_screen_id(_si)=-3048364835412835803}]

      

Screenshots of my application:

Login screen

Clicking on Facebook login icon, loading and disappearing

Also the callback is not triggered.

Can anyone please help me.

Decision

(1) "user_friends" should be added in permissions. (2) Most importantly, APPID must be syntax and NOT APPID. In developers.facebook.com the variable name is listed as "facebook_app_id" which doesn't work. The correct variable should be "facebook_application_id". These two changes solve the problem.

+3


source to share





All Articles