-
Notifications
You must be signed in to change notification settings - Fork 46
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]: The browser window cannot close properly after logging in success on the Android physical device #113
Comments
Your |
Thank you for your reply. The error you pointed out was due to my typo. Thank you again for your quick response. |
Oh okay, sorry, should have known that... |
I am experiencing the same issue. I made a short video of my setup, very basic app with a custom scheme configured. I've tried multiple versions of the 4.0.0-alpha.X, they all have the same behavior. I'm using Android API 34. I have tried with and without passing |
@tmarkovski Thank you very much for the video - this is one of the most helpful bug reports I have ever received :) |
You're welcome, it is also the fastest way to describe a problem. That's correct, it seems like it navigates back, but the custom tab is still there. Either way, the app is launched correctly and the result is returned by the |
anyone figured this out? I'm having the same issue on android device, after login the activity screen does not go away |
I'm sorry that I have not yet been able to look at it properly. I will update you once I had time to investigate |
@ThexXTURBOXx Hi i am facing same issue after login the activity screen does not go away |
@irfan512 I am aware of the issue :) |
To add more information, it only happens on a physical Android device. On the emulator, it works without issue. |
@joaquingrech on a physical Android device it not come back in app |
I think I found the issue. Can you paste your androidmanifest? the launch mode of your main activity? It seems it must be set to singleTop. Mine was set to singleInstance and when I switched to singleTop it began working. How's yours? |
@joaquingrech Mine is also set to |
I'm not sure why it would fail and I believe mine was set to singleInstance by some other plugin. In theory, that should not make this plugin fail unless it's creating multiple instances and overlapping each other. You may want to try with the different launch modes and see which ones work and which ones fail to add it to the documentation (or fix if possible). |
@irfan512 You have a different issue: You have not read |
so what do we do about this? The temporary fix is to use singleTop and document it on the instructions. But I don't see why it should be enforced to singleTop |
@joaquingrech Since I am unable to reproduce the issue on my app, I can't really do anything against it currently. |
I have the same issue. I am using keycloak, tab not closing but code and token works fine at the backgroud. If session is already available in Keycloak, without asking username and password keycloak retuns code and tab closing by itself as expected. |
Been trying to solve this issue but nothing. @tmarkovski do you have any updates if you resolved the problem? |
const html = '''
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Grant Access to Flutter</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>
html, body { margin: 0; padding: 0; }
main {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-height: 100vh;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol;
}
#icon {
font-size: 96pt;
}
#text {
padding: 2em;
max-width: 260px;
text-align: center;
}
#button a {
display: inline-block;
padding: 6px 12px;
color: white;
border: 1px solid rgba(27,31,35,.2);
border-radius: 3px;
background-image: linear-gradient(-180deg, #34d058 0%, #22863a 90%);
text-decoration: none;
font-size: 14px;
font-weight: 600;
}
#button a:active {
background-color: #279f43;
background-image: none;
}
</style>
</head>
<body>
<main>
<div id="icon">🏇</div>
<div id="text">Press the button below to sign in using your localhost account.</div>
<div id="button"><a href="CALLBACK_URL_HERE" onclick="closeWin()">Sign in</a></div>
</main>
</body>
<script>
function closeWin(){
window.close()
}
</script>
</html>
''';
- add function
<script>
function closeWin(){
window.close()
}
</script>
- add onclick
<div id="button"><a href="CALLBACK_URL_HERE" onclick="closeWin()">Sign in</a></div> |
This seems to be related to task affinity. I had |
Can confirm this worked for me |
Description
After successfully logging into the app, the browser window cannot be closed properly on Android devices. According to the logs, the app has already obtained the accessToken. The same operation works perfectly on iOS.
Similar links are here.
#106
according this thread, flutter_web_auth_2 was upgraded to version ^4.0.0-alpha.0
Minimal Reproduction
Steps to reproduce the behaviour:
Exception or Error
There's no error log
Expected Behaviour
The web browser should close and app should come into focus
Screenshots
No response
Additional context
flutter doctor -v
[✓] Flutter (Channel stable, 3.22.1, on macOS 14.5 23F79 darwin-x64, locale en-US)
• Flutter version 3.22.1 on channel stable at /Users/username/Documents/development/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision a14f74ff3a (3 weeks ago), 2024-05-22 11:08:21 -0500
• Engine revision 55eae6864b
• Dart version 3.4.1
• DevTools version 2.34.3
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/username/Documents/development/Android/sdk
• Platform android-34-ext8, build-tools 34.0.0
• ANDROID_HOME = /Users/username/Documents/development/Android/sdk
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15F31d
• CocoaPods version 1.15.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2023.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 17.0.7+0-17.0.7b1000.6-10550314)
[✓] VS Code (version unknown)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.90.0
✗ Unable to determine VS Code version.
[!] Proxy Configuration
• HTTP_PROXY is set
! NO_PROXY is not set
[✓] Connected device (4 available)
• Pixel 6a (mobile) • codemasked • android-arm64 • Android 14 (API 34)
• macOS (desktop) • macos • darwin-x64 • macOS 14.5 23F79 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 125.0.6422.142
Device
pixel 6a
OS
Android 14
Browser
Chrome
Flutter version
Flutter version 3.22.1
flutter_web_auth_2 version
^4.0.0-alpha.0
Checklist
The text was updated successfully, but these errors were encountered: