ThexXTURBOXx / flutter_web_auth_2

Flutter plugin for authenticating a user with a web service
https://pub.dev/packages/flutter_web_auth_2
MIT License
51 stars 50 forks source link

Browser window is closed and cancel called when app is sent to background and foreground again on Android #93

Closed adminant closed 8 months ago

adminant commented 8 months ago

Description

When calling authenticate, browser window opened, then I switch to other app so my app with opened browser is sent to background. Then I switch back to my app - and no browser with auth is visible, and cancel called. This behavior is only on Android, in iOS browser remains open, and I can continue auth. It is very frustrating, becauseI can't switch on Android to other app to copy credentials for example and then continue auth process.

Minimal Reproduction

Steps to reproduce the behaviour:

Use flutter_web_auth_2 3.1.1 and switch app during auth process on Android then switch back

Exception or Error

User canceled login

Expected Behaviour

Browser with auth page must remain when switching back to app after switching to another app

Screenshots

No response

Additional context

No response

Device

Android Simulator or any android device

OS

any

Browser

any

Flutter version

3.x

flutter_web_auth_2 version

3.1.1

Checklist

ThexXTURBOXx commented 8 months ago

Your Minimal Reproduction does not contain any code, so I have to guess: You are using ephemeralIntentFlags. If that is the case, then this is the expected behavior. Otherwise, this is not something completely related to this package, but rather something you need to set up yourself in AndroidManifest.xml. Please consult StackOverflow for that. Because of that, I will close this as completed.

adminant commented 8 months ago

No any flags are used when calling authenticate. Could you please provide a direction how can I achieve Android behavior the same as iOS?

adminant commented 8 months ago

Same issue is disussed here, maybe it would help somehow https://github.com/aboutyou/dart_packages/issues/162

I tried to play with flags, but getting error "Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?" How can we start activity without this flag?