Android 10 Open in Chrome action cancels authorisation flow
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.
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?
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.
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.
@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 , 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 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.
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
After tried this @agologan's solution, I resolved by clearing the Default app (Chrome) from Settings
@huynguyennovem , in this case issues are unrelated.