firebase / FirebaseUI-Android

Optimized UI components for Firebase
https://firebaseopensource.com/projects/firebase/firebaseui-android/
Apache License 2.0
4.63k stars 1.83k forks source link

Firebase AuthUI exception serialization error when logging in with Google #1579

Open AngelStanislavovAngelov opened 5 years ago

AngelStanislavovAngelov commented 5 years ago

General Information

Describe the problem:

Some of the users encounter a problem when using Google as their Identity provider. The UI loading indicator on the top of the screen just hangs there and loading goes on forever. Some of them have even a video of the problem. My observations were that there was no error thrown, because what happens when Firebase Auth returns an exception is that it is communicated back to the user uder the form of a dialog. However, in this case we do not receive anything, which means that the block of code which handles logging the exception and presenting an adequate error message is not being called. So the stacktrace which I have pasted below might not actually be the real cause of the problem, however, I have failed to find any other developers encountering the same issue.

Steps to reproduce

  1. Start the application
  2. User gets presented with Authentication Screen
  3. User presses Login with Google button
  4. Loading indicator hangs

Observed Results:

Crashlytics has logged the following exception:

Non-fatal Exception: com.firebase.ui.auth.FirebaseUiException Exception serialization error, forced wrapping. Original: com.firebase.ui.auth.FirebaseUiException: Play Services update cancelled, original cause: com.google.android.gms.common.api.ApiException: 13: com.firebase.ui.auth.KickoffActivity$2.onFailure (KickoffActivity.java:72) com.google.android.gms.tasks.zzl.run (Unknown Source:4) android.os.Handler.handleCallback (Handler.java:739) android.os.Handler.dispatchMessage (Handler.java:95) android.os.Looper.loop (Looper.java:145) android.app.ActivityThread.main (ActivityThread.java:6934) java.lang.reflect.Method.invoke (Method.java) java.lang.reflect.Method.invoke (Method.java:372) com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:1404) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1199)

Relevant Code:

    val providers = Arrays.asList<AuthUI.IdpConfig>(
            AuthUI.IdpConfig.GoogleBuilder().build(),
            AuthUI.IdpConfig.FacebookBuilder().build(),
            AuthUI.IdpConfig.EmailBuilder().build())

    startActivityForResult(
            AuthUI.getInstance()
                    .createSignInIntentBuilder()
                    .setIsSmartLockEnabled(false)
                    .setTheme(R.style.GreenTheme)
                    .setLogo(R.drawable.logo_white_android)
                    .setAvailableProviders(providers)
                    .build(),
            RC_SIGN_IN
    )
samtstern commented 5 years ago

Sounds like Google Sign In failed and FirebaseUI just caught and wrapped the exception:

Original: com.firebase.ui.auth.FirebaseUiException: Play Services update cancelled, original cause: com.google.android.gms.common.api.ApiException: 13:

My best guess would be that this happens when the user tries to use Google Sign In, needs to update Play Services, and then the update does not finish.

samtstern commented 5 years ago

There's almost definitely nothing you can do about it! There may be something I can do about it but first I need to determine if this is a FirebaseUI bug or a Google Sign In bug.

On Tue, Feb 5, 2019, 9:00 AM AngelStanislavovAngelov < notifications@github.com> wrote:

Hello Sam,

So this would mean that it is something which occurs from time to time and there is nothing that we can do about it ?

Best regards,

Angel Angelov

On Tue, Feb 5, 2019 at 5:47 PM Sam Stern notifications@github.com wrote:

Sounds like Google Sign In failed and FirebaseUI just caught and wrapped the exception:

Original: com.firebase.ui.auth.FirebaseUiException: Play Services update cancelled, original cause: com.google.android.gms.common.api.ApiException: 13:

My best guess would be that this happens when the user tries to use Google Sign In, needs to update Play Services, and then the update does not finish.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub < https://github.com/firebase/FirebaseUI-Android/issues/1579#issuecomment-460688136 , or mute the thread < https://github.com/notifications/unsubscribe-auth/AsVNg3mpY5wrg05bWR-DlqHv8p69kH4eks5vKaeKgaJpZM4ai5tS

.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/firebase/FirebaseUI-Android/issues/1579#issuecomment-460717229, or mute the thread https://github.com/notifications/unsubscribe-auth/AIEw6p8Hm48VDpVdfN-Ym5P_Drlq2Jblks5vKbiggaJpZM4ai5tS .

AngelStanislavovAngelov commented 5 years ago

Alright, please do let me know if there is any resolution to this problem. Thanks!

bakua commented 4 years ago

Having the same issue from time to time. In one of those cases, user had Xiaomi phone and had to enable a Google access for my app in the phone settings or something like that.

kamdaou commented 2 years ago

I am having this : Sign in unsuccessful Exception serialization error, forced wrapping. Original: com.firebase.ui.auth.FirebaseUiException: Play Services update cancelled, original cause: com.google.android.gms.common.api. ApiException: 9: Error connecting to Google Play services when using a huawei phone which does not have google play services ; when I am using a device with google play services, there is no error. What I don't understand is that google play services are no longer required for firebase authentication, so I am wondering what may be the cause !

GregoryError commented 1 year ago

I have the save exception some times original cause: com.google.android.gms.common.api. ApiException: 9: Error connecting to Google Play services

leocorder commented 10 months ago

Hi, @kamdaou Did you manage to figure out the reason for this problem? Some of my app users are reporting the same problem when trying to sign in from Huawei phones. I can't understand either why Firebase throws this exception if Google Play Services is not a requirement for Firebase Auth. Can anyone help with this?

kamdaou commented 10 months ago

Hi @leocorder Yes, in my case I was using the following code:

startActivityForResult(
       AuthUI.getInstance()
           .createSignInIntentBuilder()
           .setAvailableProviders(providers)
           .build(),
       MainFragment.SIGN_IN_REQUEST_CODE
   )

But AuthUi is a prebuilt UI and probably needs Google Play services. So, I created my UI instead and used a password-based authentication. You could use it for devices that don't have Google Play services. Here is the link for doing that.

leocorder commented 10 months ago

Thanks for your quick response @kamdaou. I'm using similar code to initiate the sign in/sign up flow in my app.

Unfortunately I believe the only solution currently would be to actually implement my own UI, as you did, since FirebaseUI depends on Google Play Services, although Firebase Auth does not. Thank you for your help.