Description
Description
Can minimizing a browser window not cause a FlutterWebAuth2.authenticate exception? If not, is there a way to close an external browser window on an exception?
In a locked-down network on Android, I must use Microsoft Edge, not Chrome so I have implemented FlutterWebAuth2 using an Android intent-filter instead of a webView to launch the Edge browser. If I minimize the browser window instead of filling in credentials, the authenicate() call fails with an exception. This in itself is OK, but it leaves the browser window minimized, which can then be maximized and filled-in, even though the code is no longer waiting for it.
Minimal Reproduction
Minimize the browser window launched by FlutterWebAuth2.authenticate:
<activity
android:name="com.linusu.flutter_web_auth_2.CallbackActivity"
android:exported="true">
<intent-filter android:label="flutter_web_auth_2">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="XXXXXXXX" />
</intent-filter>
</activity>
late final String responseString;
try {
responseString = await FlutterWebAuth2.authenticate(
url: authorizationUrl.toString(),
options: FlutterWebAuth2Options(intentFlags: ephemeralIntentFlags),
callbackUrlScheme: kIsWeb ? 'https' : "custom",
);
} catch (e) {
printError("oauth 2.0", "FlutterWebAuth2.authenticate failure: $e");
}
Exception or Error
PlatformException(CANCELED, User canceled login, null, null)�[0m
Expected Behaviour
Best would be if minimizing the browser window did not cause a platform exception, but instead allowed the authenticate() call to wait.
Screenshots
No response
Additional context
No response
Device
SM T220
OS
Android
Browser
Edge
Flutter version
3.24.1
flutter_web_auth_2 version
3.0.0
Checklist
- I have read and followed the entire troubleshooting guide and it has not provided the solution I need.
- I have provided all the information I can.