Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Minimizing an external browser window causes a FlutterWebAuth2.authenicate exception. #132

Open
2 tasks done
mgeilich opened this issue Oct 7, 2024 · 0 comments
Open
2 tasks done
Assignees
Labels
bug Something isn't working

Comments

@mgeilich
Copy link

mgeilich commented Oct 7, 2024

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.
@mgeilich mgeilich added the bug Something isn't working label Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants