You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-03-30] [$250] User is forwarded to onelogin on sign out without a cancel prompt #83056
Version Number: 9.3.23-2 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:#82787 Email or phone of affected tester (no customers):applausetester+saml1@applause.expensifail.com Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: Google Pixel 9 Pro, Android 16 App Component: User Settings
changed the title [-]User is forwarded to onelogin on sign out without a cancel prompt[/-][+][$250] User is forwarded to onelogin on sign out without a cancel prompt[/+]on Feb 20, 2026
Please re-state the problem that we are trying to solve in this issue.
When a SAML/SSO user taps "Sign out" on Android, they are immediately redirected to the OneLogin sign-in page without seeing a cancel/confirm prompt. Even if the user navigates back without completing any action on the webview, they are still signed out. PR #82787 fixed this for iOS but the same problem persists on Android.
What is the root cause of that problem?
The SAML sign-out flow in callSAMLSignOut (src/libs/actions/Session/index.ts:260-274) opens the SAML logout URL via openAuthSessionAsync from expo-web-browser. This function behaves differently on iOS vs Android:
On iOS:openAuthSessionAsync uses the native ASWebAuthenticationSession, which shows a system-level consent dialog before loading the URL. If the user taps "Cancel", the URL is never loaded, the function returns { type: 'cancel' }, and callSAMLSignOut correctly rejects with 'Logout cancelled' — the user stays logged in.
On Android:openAuthSessionAsync falls back to a polyfill (expo-web-browser/src/WebBrowser.ts:384-420) that immediately opens a Chrome Custom Tab and navigates to the SAML logout URL. There is no confirmation prompt. The moment the URL loads, the SAML Identity Provider (OneLogin) processes the logout request server-side, invalidating the session. When the user presses back, the polyfill correctly returns { type: 'dismiss' } and the app skips the LOG_OUT API call — but the IdP session is already invalidated. Additionally, if the IdP auto-redirects to the expensify://open deep link after processing logout, the redirect listener wins the Promise.race with { type: 'success' }, causing the app to also call the LOG_OUT API, completing the sign-out on both sides.
The core issue is that on Android there is no way to present a cancellation prompt before the SAML logout URL is loaded in the browser.
What changes do you think we should make in order to solve the problem?
In callSAMLSignOut (or at the call site in signOutAndRedirectToSignIn), add a platform check for Android that shows an Alert.alert confirmation dialog before calling openAuthSessionAsync. If the user confirms, proceed with opening the SAML logout URL. If they cancel, reject the promise early without ever opening the browser.
This mirrors the native behavior that iOS gets for free via ASWebAuthenticationSession's built-in consent prompt, but implements it at the application level for Android where no such native prompt exists.
The change would be in src/libs/actions/Session/index.ts, in the callSAMLSignOut function, wrapping the openAuthSessionAsync call in a confirmation dialog on Android (using Platform.OS === 'android').
What alternative solutions did you explore? (Optional)
Using a custom WebView instead of Chrome Custom Tabs — This would give more control over the flow but would revert the improvement from PR Replace WebView in SAML sign in implementation #76246 which specifically moved away from WebView to expo-web-browser for security and reliability reasons.
Deferring the server-side logout — Instead of passing the authToken as a query parameter in the URL (which triggers immediate server-side logout on page load), the app could open a confirmation page first and only trigger the actual SAML logout after user confirmation. However, this would require server-side changes to the SAML logout endpoint.
Detailed Investigation
Root Cause Analysis
The sign-out flow for SAML users works as follows:
User taps "Sign out" → signOutAndRedirectToSignIn() is called (index.ts:325)
signOut() is called with signedInWithSAML=true (index.ts:347)
callSAMLSignOut opens ${SAML_URL}/logout?authToken=<token> via openAuthSessionAsync with redirect URL expensify://open (index.ts:262)
The openAuthSessionAsync from expo-web-browser (v15.0.10) has platform-specific behavior:
iOS/macOS: Uses native ExponentWebBrowser.openAuthSessionAsync → ASWebAuthenticationSession which shows a system consent dialog before loading the URL
Android: Since _authSessionIsNativelySupported() returns false for Android (WebBrowser.ts:323-324), it uses _openAuthSessionPolyfillAsync which runs a Promise.race between _openBrowserAndWaitAndroidAsync (Chrome Custom Tab + AppState listener) and _waitForRedirectAsync (deep link listener)
On Android, Chrome Custom Tabs immediately loads the SAML logout URL. The SAML IdP processes the logout upon page load. Even if the user presses back:
The app correctly detects { type: 'dismiss' } and rejects with 'Logout cancelled'
The .catch in signOutAndRedirectToSignIn at line 454 just logs a warning
But the SAML IdP session is already invalidated server-side
Evidence Chain
openAuthSessionAsync on Android immediately opens the URL (no native confirmation) → SAML IdP processes logout on page load → session invalidated server-side
User presses back → AppState becomes 'active' → polyfill returns { type: 'dismiss' } → callSAMLSignOut rejects → app doesn't call LOG_OUT API → but session is already dead
OR: SAML IdP auto-redirects to expensify://open → _waitForRedirectAsync resolves with { type: 'success' } → callSAMLSignOut calls LOG_OUT API → user is fully signed out
Confidence: High — the platform difference in expo-web-browser's openAuthSessionAsync (native ASWebAuthenticationSession on iOS vs Chrome Custom Tab polyfill on Android) directly explains why the iOS fix in PR #82787 doesn't apply to Android.
Next Steps for Contributor+ team: Reply with @MelvinBot implement this to create a draft PR, or @MelvinBot <your feedback> to refine this analysis.
📣 @husamdaifalla01-cmyk! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Get the email address used to login to your Expensify account. If you don't already have an Expensify account, create one here. If you have multiple accounts (e.g. one for testing), please use your main account email.
Get the link to your Upwork profile. It's necessary because we only pay via Upwork. You can access it by logging in, and then clicking on your name. It'll look like this. If you don't already have an account, sign up for one here.
Copy the format below and paste it in a comment on this issue. Replace the placeholder text with your actual details.
Format:
Contributor details
Your Expensify account email: <REPLACE EMAIL HERE>
Upwork Profile Link: <REPLACE LINK HERE>
⚠️@husamdaifalla01-cmyk Your proposal is a duplicate of an already existing proposal and has been automatically withdrawn to prevent spam. Please review the existing proposals before submitting a new one.
@jjcoffee The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: N/A - Mobile-Expensify native bug
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Activity
melvin-bot commentedon Feb 20, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @jjcoffee (
External)melvin-bot commentedon Feb 20, 2026
Triggered auto assignment to @heyjennahay (
Bug), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.[-]User is forwarded to onelogin on sign out without a cancel prompt[/-][+][$250] User is forwarded to onelogin on sign out without a cancel prompt[/+]melvin-bot commentedon Feb 20, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022024856527900868590
MelvinBot commentedon Feb 20, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a SAML/SSO user taps "Sign out" on Android, they are immediately redirected to the OneLogin sign-in page without seeing a cancel/confirm prompt. Even if the user navigates back without completing any action on the webview, they are still signed out. PR #82787 fixed this for iOS but the same problem persists on Android.
What is the root cause of that problem?
The SAML sign-out flow in
callSAMLSignOut(src/libs/actions/Session/index.ts:260-274) opens the SAML logout URL viaopenAuthSessionAsyncfromexpo-web-browser. This function behaves differently on iOS vs Android:On iOS:
openAuthSessionAsyncuses the nativeASWebAuthenticationSession, which shows a system-level consent dialog before loading the URL. If the user taps "Cancel", the URL is never loaded, the function returns{ type: 'cancel' }, andcallSAMLSignOutcorrectly rejects with'Logout cancelled'— the user stays logged in.On Android:
openAuthSessionAsyncfalls back to a polyfill (expo-web-browser/src/WebBrowser.ts:384-420) that immediately opens a Chrome Custom Tab and navigates to the SAML logout URL. There is no confirmation prompt. The moment the URL loads, the SAML Identity Provider (OneLogin) processes the logout request server-side, invalidating the session. When the user presses back, the polyfill correctly returns{ type: 'dismiss' }and the app skips theLOG_OUTAPI call — but the IdP session is already invalidated. Additionally, if the IdP auto-redirects to theexpensify://opendeep link after processing logout, the redirect listener wins thePromise.racewith{ type: 'success' }, causing the app to also call theLOG_OUTAPI, completing the sign-out on both sides.The core issue is that on Android there is no way to present a cancellation prompt before the SAML logout URL is loaded in the browser.
What changes do you think we should make in order to solve the problem?
In
callSAMLSignOut(or at the call site insignOutAndRedirectToSignIn), add a platform check for Android that shows anAlert.alertconfirmation dialog before callingopenAuthSessionAsync. If the user confirms, proceed with opening the SAML logout URL. If they cancel, reject the promise early without ever opening the browser.This mirrors the native behavior that iOS gets for free via
ASWebAuthenticationSession's built-in consent prompt, but implements it at the application level for Android where no such native prompt exists.The change would be in
src/libs/actions/Session/index.ts, in thecallSAMLSignOutfunction, wrapping theopenAuthSessionAsynccall in a confirmation dialog on Android (usingPlatform.OS === 'android').What alternative solutions did you explore? (Optional)
Using a custom WebView instead of Chrome Custom Tabs — This would give more control over the flow but would revert the improvement from PR Replace WebView in SAML sign in implementation #76246 which specifically moved away from WebView to
expo-web-browserfor security and reliability reasons.Deferring the server-side logout — Instead of passing the
authTokenas a query parameter in the URL (which triggers immediate server-side logout on page load), the app could open a confirmation page first and only trigger the actual SAML logout after user confirmation. However, this would require server-side changes to the SAML logout endpoint.Detailed Investigation
Root Cause Analysis
The sign-out flow for SAML users works as follows:
signOutAndRedirectToSignIn()is called (index.ts:325)signOut()is called withsignedInWithSAML=true(index.ts:347)signOut()delegates tocallSAMLSignOut()(index.ts:252-253)callSAMLSignOutopens${SAML_URL}/logout?authToken=<token>viaopenAuthSessionAsyncwith redirect URLexpensify://open(index.ts:262)The
openAuthSessionAsyncfromexpo-web-browser(v15.0.10) has platform-specific behavior:ExponentWebBrowser.openAuthSessionAsync→ASWebAuthenticationSessionwhich shows a system consent dialog before loading the URL_authSessionIsNativelySupported()returnsfalsefor Android (WebBrowser.ts:323-324), it uses_openAuthSessionPolyfillAsyncwhich runs aPromise.racebetween_openBrowserAndWaitAndroidAsync(Chrome Custom Tab + AppState listener) and_waitForRedirectAsync(deep link listener)On Android, Chrome Custom Tabs immediately loads the SAML logout URL. The SAML IdP processes the logout upon page load. Even if the user presses back:
{ type: 'dismiss' }and rejects with'Logout cancelled'.catchinsignOutAndRedirectToSignInat line 454 just logs a warningEvidence Chain
openAuthSessionAsyncon Android immediately opens the URL (no native confirmation) → SAML IdP processes logout on page load → session invalidated server-side{ type: 'dismiss' }→callSAMLSignOutrejects → app doesn't call LOG_OUT API → but session is already deadexpensify://open→_waitForRedirectAsyncresolves with{ type: 'success' }→callSAMLSignOutcalls LOG_OUT API → user is fully signed outRelevant Code
src/libs/actions/Session/index.ts:260-274-callSAMLSignOutfunctionsrc/libs/actions/Session/index.ts:325-455-signOutAndRedirectToSignInfunctionexpo-web-browser/src/WebBrowser.ts:234-250-openAuthSessionAsyncwith platform branchingexpo-web-browser/src/WebBrowser.ts:354-420- Android polyfill implementationConfidence: High — the platform difference in
expo-web-browser'sopenAuthSessionAsync(nativeASWebAuthenticationSessionon iOS vs Chrome Custom Tab polyfill on Android) directly explains why the iOS fix in PR #82787 doesn't apply to Android.Next Steps for Contributor+ team: Reply with
@MelvinBot implement thisto create a draft PR, or@MelvinBot <your feedback>to refine this analysis.husamdaifalla01-cmyk commentedon Feb 20, 2026
🚫 Duplicated proposal withdrawn by 🤖 ProposalPolice.
melvin-bot commentedon Feb 20, 2026
📣 @husamdaifalla01-cmyk! 📣
Hey, it seems we don’t have your contributor details yet! You'll only have to do this once, and this is how we'll hire you on Upwork.
Please follow these steps:
Format:
github-actions commentedon Feb 20, 2026
25 remaining items
melvin-bot commentedon Mar 23, 2026
@jjcoffee The PR fixing this issue has been merged! The following checklist (instructions) will need to be completed before the issue can be closed. Please copy/paste the BugZero Checklist from here into a new comment on this GH and complete it. If you have the K2 extension, you can simply click: [this button]
melvin-bot commentedon Mar 23, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)jjcoffee commentedon Mar 25, 2026
Noting that this was not a regression as it was reproducible on production.
jjcoffee commentedon Mar 25, 2026
BugZero Checklist:
[Contributor] The offending PR has been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
Link to comment: N/A - Mobile-Expensify native bug
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: N/A
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
[BugZero Assignee] Create a GH issue for creating/updating the regression test once above steps have been agreed upon.
Link to issue: https://github.com/Expensify/Expensify/issues/618626
Regression Test Proposal
Test:
Do we agree 👍 or 👎
Zapier Logs
Run ID: 00040eee-49b7-a537-e05e-600ea2066824melvin-bot commentedon Mar 30, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
melvin-bot commentedon Mar 30, 2026
Payment Summary
Upwork Job
BugZero Checklist (@mallenexpensify)
mallenexpensify commentedon Mar 31, 2026
Payment Summary
Contributor+: @jjcoffee due $250 via NewDot
Thanks @jjcoffee for commenting about the regression comment on the PR
^ Test case created
JmillsExpensify commentedon Apr 6, 2026
$250 approved for @jjcoffee