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

Different behavior in iOS and Android when switching apps #94

Closed adminant closed 8 months ago

adminant commented 8 months ago

Description

in iOS when auth browser window is open and we switch to other app and switch back, browser remains active and we can continue authenticating. In Android when we switch to another app and back, browser window is disappeared, and 'user canceled login' error is received. No any flags are used when calling authenticate. I think this is not intended behavior, because 1) iOS and Android behavior is different 2) In Android user can't switch app to copy/paste credentials, which is bad user experience, so we receive bad reviews

I tried to google this bug and seems it is very common in other auth and 3ds libraries, and is related to Chrome Custom Tabs, but it is unclear how to avoid closing tab when switching apps.

Minimal Reproduction

Steps to reproduce the behaviour:

  1. Use the following code: final result = await FlutterWebAuth2.authenticate( url: url, callbackUrlScheme: url-scheme, );

Exception or Error

User canceled login event after switching app

Expected Behaviour

Browser window remains on top after switching app

Screenshots

No response

Additional context

No response

Device

Android simulator, Google Pixel. Xiaomi, etc

OS

iOS 15.5

Browser

none

Flutter version

3.3.10

flutter_web_auth_2 version

3.1.1

Checklist

ThexXTURBOXx commented 8 months ago

Duplicate of #93