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

Android 10 Open in Chrome action cancels authorisation flow

Open ekrivenja-sequenex opened this issue 5 years ago • 9 comments

It seems like only API29 platform issue, but Android 10 is a mainstream version now, at least a workaround is needed.

Issue is reproducible in the demo app. Steps:

  • Start authorisation flow using Chrome tab in Android 10 emulator
  • In started Chrome tab tap more options and choose Open in Chrome
  • Sometimes immediately, sometimes after even successfully sign in, but always flow ends with "Authorisation cancelled" error.

I investigated the issue little bit, the library cancels flow because the platform calls onResume for AuthorizationManagementActivity on "Open in Chrome" user action.

It is probably related to multi-display change in Android 10 https://source.android.com/devices/tech/display/multi_display/multi-resume#multiple

But looks like a bug, since doesn't reproducible on Android 11.

ekrivenja-sequenex avatar Jan 05 '21 13:01 ekrivenja-sequenex

I've just tested the demo app on Android 10 and didn't come access the issue. Is it always happening on Android 10 or does it happen intermittently?

Also when you click "Open in Chrome", if you manually go back to the app, is the chrome custom tab still open?

amrfarid140 avatar Jan 06 '21 09:01 amrfarid140

Hi @amrfarid140 , It is always happening on Android 10 if I use Open in Chrome option. You need to finish sign-in to see the issue. Chrome tab is closed, it behaves correctly there.

Let me check once more with another OAuth provider to be sure.

ekrivenja-sequenex avatar Jan 06 '21 09:01 ekrivenja-sequenex

Yeah I just tested exactly this and it worked. My only point about checking to see if the chrome custom tab still open before finishing the sign-in in the actual browser is to see if something is triggering a cancelled sign-in flow.

amrfarid140 avatar Jan 06 '21 10:01 amrfarid140

@ekrivenja-sequenex do you mind telling us which version of the lib and what device you're testing this on and is exhibiting the issue?

agologan avatar Jan 28 '21 18:01 agologan

@agologan , we faced this issue in latest released version of the lib (0.7.1) on Android 10, but I am able to reproduce it using Android 10 emulator with AppAuth Demo app from master, check out the video link https://user-images.githubusercontent.com/72198328/106203022-0d9b6b00-61bb-11eb-9752-5eb4415db029.mp4

With pending intent it seems more clear and easy to reproduce. https://user-images.githubusercontent.com/72198328/106204509-5e13c800-61bd-11eb-9a30-335316a30f69.mp4

ekrivenja-sequenex avatar Jan 28 '21 21:01 ekrivenja-sequenex

@ekrivenja-sequenex took me a few days to find some time to look at this and your information about reproducing this in an emulator with the sample app was helpful.

We don't have an ETA on a fix but I'm glad we could confirm it's an issue some users may experience. There's also very few (if any) reasons a user would want to get out of the custom tab so I wouldn't be too worried about it.

agologan avatar Feb 02 '21 22:02 agologan

Same issue related to this. But it does not need to perform action Open in Chrome. This cause by user has canceled the login flow before. Then after attempting to re-login later, we got this error log.

p/s: the strange thing that the native sample worked normally. I got error log from the flutter lib which used this native lib. Still have no solution yet.

FYI about this error: https://github.com/MaikuB/flutter_appauth/issues/56

huynguyennovem avatar Jun 21 '21 15:06 huynguyennovem

After tried this @agologan's solution, I resolved by clearing the Default app (Chrome) from Settings

huynguyennovem avatar Jun 21 '21 18:06 huynguyennovem

@huynguyennovem , in this case issues are unrelated.

ekrivenja-sequenex avatar Jun 21 '21 18:06 ekrivenja-sequenex