-
Notifications
You must be signed in to change notification settings - Fork 2
fix(mobile): avoid stuck WebBrowser auth session on Android #4376
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WARNING: Android now opens the browser with
openBrowserAsync, but approval still dismisses viadismissAuthSession()WebBrowser.dismissAuthSession()only affects sessions started withopenAuthSessionAsync; it has no effect on a browser opened withopenBrowserAsync. Since Android now goes throughopenBrowserAsyncin bothstart()andopenBrowser(), the tab opened on Android will no longer auto-close when polling detects approval (thecase 200:branch inpoll()still callsWebBrowser.dismissAuthSession()). The user will have to manually switch back to the app after approving sign-in on Android. Consider callingWebBrowser.dismissBrowser()on Android in that success path as well.Reply with
@kilocode-bot fix itto have Kilo Code address this issue.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Checked against expo-web-browser 55.0.16 source: the Android native module (
WebBrowserModule.kt) implements no dismissal at all — nodismissBrowser, nodismissAuthSession. Custom tabs can't be closed programmatically; return-to-app is handled byBrowserProxyActivitywhen the user closes the tab.dismissAuthSession()on Android has always taken the JS fallback branch targetingExponentWebBrowser.dismissBrowser, which doesn't exist there — so the tab never auto-closed on Android before this PR either, anddismissBrowser()(ExponentWebBrowser.dismissBrowser?.()) would be a no-op. No regression.The valid part: with Android no longer opening an auth session, the unconditional
dismissAuthSession()inpoll()is pointless there and a latentUnavailabilityErrorthrow site inside the poll's try block. Follow-up guards it to iOS: #4377