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

WebView Browser stays open after successful call to FlutterWebAuth.authenticate #133

Open
mikeryder opened this issue Jul 29, 2022 · 3 comments

Comments

@mikeryder
Copy link

FlutterWebAuth 0.4.1

AndroidManifest.xml:
<activity android:exported="true" android:name="com.linusu.flutter_web_auth.CallbackActivity" > <intent-filter android:label="flutter_web_auth"> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="your-focus" /> </intent-filter> </activity>

Flutter call:
final result = await FlutterWebAuth.authenticate(url: _authorizationEndpointUrl, callbackUrlScheme: 'your-focus'); String? code = Uri.parse(result).queryParameters['code']; print('MS365 Code: ' + (code ?? ""));

This prints the Code correctly, but the WebView Browser remains open.

The relevant section of the logcat:

2022-07-29 14:41:03.954 515-540/? I/ActivityTaskManager: Displayed org.chromium.webview_shell/.WebViewBrowserActivity: +193ms
2022-07-29 14:41:03.957 515-535/? D/EventSequenceValidator: Transition from ACTIVITY_LAUNCHED to ACTIVITY_FINISHED
2022-07-29 14:41:04.063 515-5660/? I/ActivityTaskManager: START u0 {act=android.intent.action.VIEW cat=[android.intent.category.BROWSABLE] dat=your-focus://auth/?code=xxxxxxx&session_state=040e2895-c9fa-44ba-ba65-c94575313b7e cmp=com.your_focus.app/com.linusu.flutter_web_auth.CallbackActivity (has extras)} from uid 10088
2022-07-29 14:41:04.063 515-535/? D/EventSequenceValidator: Transition from ACTIVITY_FINISHED to INTENT_STARTED
2022-07-29 14:41:04.071 515-535/? D/EventSequenceValidator: Transition from INTENT_STARTED to INTENT_FAILED
2022-07-29 14:41:04.072 515-5660/? W/ActivityTaskManager: Tried to set launchTime (0) < mLastActivityLaunchTime (3102689785)

I am connecting to the Microsoft OAUTH to get a token for Microsoft 365 Graph API.

Any thoughts on a fix or further debugging would be appreciated!

@TheCarpetMerchant
Copy link

TheCarpetMerchant commented Aug 6, 2022

@LinusU This is happening to me too. What's weird is that it worked the very first time I tried it, then subsequently failed all other attempts.
I'm calling google OAuth and everything works fine, except that the webview stays open afterwards and redirects the user to www.google.com.

Edit : it seems according to https://bugs.chromium.org/p/chromium/issues/detail?id=545446 that it would suffice for the app to redirect to the main activity.

@s1dc0des
Copy link

s1dc0des commented Mar 6, 2023

Yo any solutions for this. the browser tab stays open after auth process.

@BBQRIBS72
Copy link

BBQRIBS72 commented Mar 9, 2023

This is also happening for me.

Workaround: I found that if you set preferEphemeral to true, the browser closes after auth. But it also causes the browser to close if the user leaves it at all, so it doesn't help my situation as I want users to have the option to copy a MFA code from a different app - but when they return the browser will be closed.

Maybe preferEphemeral: true can help your case, but I would love the browser to close after auth whether it is true or false.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants