AppAuth-Android icon indicating copy to clipboard operation
AppAuth-Android copied to clipboard

Authentication state lost while app switching

Open cromestant opened this issue 10 years ago • 2 comments

Hello, we have integrated this into an openid connect solution without issue really top notch, however we have run into a problem. In essence, our app requires to switch to SMS to get a one time password, during authentication. When we do, we lose the application state and we no longer see the screen for the OTP in the custom tab.

Is there a way to force the auth state to be stored and restored upon coming back?

cromestant avatar Sep 12 '16 13:09 cromestant

the problem was being set with a flag: https://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_NO_HISTORY

Make sure the flag is correctly set to maintain history and the activity with the custom tab will not close upon losing focus

cromestant avatar Sep 14 '16 17:09 cromestant

I just ran into this problem. Basically, my service uses 2FA, which makes the users switch to another app to approve the request. I think this would be a problem for most services that require 2FA. The solution presented by @cromestant is to update the code in AuthorizationService.performAuthorizationRequest

Is there a workaround that doesn't require updating the library? I'm just adding a dependency in my Gradle file, so updating that setting in the library is not an option.

ricalo avatar Sep 19 '16 22:09 ricalo