Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
AngelStanislavovAngelov opened this issue Feb 5, 2019 · 9 comments

Comments

@AngelStanislavovAngelov
Copy link

AngelStanislavovAngelov commented Feb 5, 2019

General Information

  • Android device: Samsung, Huawei, Hisense, TECNO
  • Android OS version: 5,6,7
  • Google Play Services version: 16.1.0
  • Firebase/Play Services SDK version: 16.0.6
  • FirebaseUI version: 4.2.1

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
Copy link
Contributor

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
Copy link
Contributor

samtstern commented Feb 6, 2019 via email

@AngelStanislavovAngelov
Copy link
Author

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

@samtstern samtstern self-assigned this Feb 15, 2019
@bakua
Copy link

bakua commented Apr 13, 2020

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.

@samtstern samtstern removed their assignment Jul 16, 2021
@kamdaou
Copy link

kamdaou commented Feb 27, 2022

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
Copy link

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

@leocorder
Copy link

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
Copy link

kamdaou commented Dec 1, 2023

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants