-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
I am using 9.0.0.
I see that when using the credential manager and the auth method picker together, RESULT_CANCELED is always returned as the sign-in activity result, regardless of whether the authentication was actually canceled or not.
It appears that KickoffActivity receives a requestCode of 105 (RequestCodes.AUTH_PICKER_FLOW) in onActivityResult and data of null, which in turn passes this request code and null data to SigninKickstarter.activityResult. The logic here causes setResult(Resource.forFailure(UserCancellationException())) to be called -- this is what shows up in logcat:
A sign-in error occurred.
com.firebase.ui.auth.data.model.UserCancellationException: Unknown error
at com.firebase.ui.auth.data.remote.SignInKickstarter.onActivityResult(SignInKickstarter.kt:169)
at com.firebase.ui.auth.KickoffActivity.onActivityResult(KickoffActivity.java:85)
at android.app.Activity.onActivityResult(Activity.java:7721)
at android.app.Activity.internalDispatchActivityResult(Activity.java:9714)
at android.app.Activity.dispatchActivityResult(Activity.java:9691)
at android.app.ActivityThread.deliverResults(ActivityThread.java:6442)
at android.app.ActivityThread.handleSendResult(ActivityThread.java:6490)
at android.app.servertransaction.ActivityResultItem.execute(ActivityResultItem.java:78)
at android.app.servertransaction.ActivityTransactionItem.execute(ActivityTransactionItem.java:63)
at android.app.servertransaction.TransactionExecutor.executeNonLifecycleItem(TransactionExecutor.java:133)
at android.app.servertransaction.TransactionExecutor.executeTransactionItems(TransactionExecutor.java:103)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:80)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2961)
at android.os.Handler.dispatchMessage(Handler.java:132)
at android.os.Looper.dispatchMessage(Looper.java:333)
at android.os.Looper.loopOnce(Looper.java:263)
at android.os.Looper.loop(Looper.java:367)
at android.app.ActivityThread.main(ActivityThread.java:9282)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:566)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929)
and this is propagated to the sign-in activity result as a RESULT_CANCELED.
What seems to be happening is the following:
-
App starts the sign-in activity
-
The sign-in activity starts the auth method selection activity.
-
While the auth method selection activity is active, the credentials manager shows its dialog box.
-
The user chooses a valid credential, and the signin process begins.
-
While the signin process is ongoing, the auth method selection activity is canceled since auth method selection is no longer relevant, causing an activity result with request code 105 i.e.
RequestCodes.AUTH_PICKER_FLOW. -
The logic in
SigninKickstarter.activityResultpropagates the cancelation of the auth method selection incorrectly as an overall cancelation of sign-in, rather than waiting for the overall sign-in result.
Also of note: I don't actually care about the success result from the activity -- I obtain this from observing the auth status directly. However, I do need to know about real cancelations, since the "Logging in…" UI state needs to be reset.
This appears to be a regression in the 9.0.0 migration to credential manager, because cancelation was working before with smart lock and the auth picker enabled together.