Wednesday, 22 January 2020

Facebook login using firebaseui doesn't work errorCode: 100, subErrorCode: 33, errorType: GraphMethodException

I've followed the Authenticate using Facebook Login guide. When I reached "Authenticate with Firebase" it says I should follow the Facebook developer's documentation. As soon as I added the facebook_app_id in the Androidmanifest, which is in 4. Edit Your Resources and Manifest, step 4:

<meta-data android:name="com.facebook.sdk.ApplicationId" 
        android:value="@string/facebook_app_id"/>

I got an error:

Manifest merger failed : Attribute meta-data#com.facebook.sdk.ApplicationId@value value=(@string/facebook_app_id) from AndroidManifest.xml:52:13-52
    is also present at [com.firebaseui:firebase-ui-auth:4.3.1] AndroidManifest.xml:21:13-60 value=(@string/facebook_application_id).
    Suggestion: add 'tools:replace="android:value"' to <meta-data> element at AndroidManifest.xml:50:9-52:55 to override. 

It seems strange to add the key anyway, because I use Firebase so that I have an automatic drop-in UI, I'm expecting Firebase to handle this for me. The firebase documentation also says "If you integrated Facebook Login using a LoginButton" why would I want this? The whole reason you implement the firebase UI is so that you don't have to add a button etc.

When I remove facebook_app_id, then I get below error:

E/GraphResponse: {HttpStatus: 400, errorCode: 100, subErrorCode: 33, errorType: GraphMethodException, errorMessage: Unsupported get request. Object with ID '1234567890' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api}

This seems to be the problem. This is the method:

override suspend fun makeSignInIntent(): Intent {
    return withContext(ioDispatcher) {
        // Choose authentication providers
        val providers = arrayListOf(
            AuthUI.IdpConfig.EmailBuilder().build(),
            AuthUI.IdpConfig.GoogleBuilder().build()
//                AuthUI.IdpConfig.FacebookBuilder().build()
        )
        // Create and launch sign-in intent
        AuthUI.getInstance()
            .createSignInIntentBuilder()
            .setAvailableProviders(providers)
            .build()
    }
}

Please note that I excluded AuthUI.IdpConfig.FacebookBuilder().build() and still get the error.

Here is my build.gradle:

implementation 'com.firebaseui:firebase-ui-auth:4.3.1'
implementation 'com.firebaseui:firebase-ui-database:3.1.0'
implementation "com.google.firebase:firebase-auth:19.2.0"
implementation "com.google.firebase:firebase-database:19.2.0"
implementation 'com.facebook.android:facebook-android-sdk:5.0.0'
implementation 'com.facebook.android:facebook-login:5.0.0'

I've enabled Facebook login and added the necessary keys:

enter image description here

I also added the redirect URI and the Development Key Hash:

enter image description here



from Facebook login using firebaseui doesn't work errorCode: 100, subErrorCode: 33, errorType: GraphMethodException

No comments:

Post a Comment