[$175] iOS - Log in - Online magic link does not open the linked report when signed out
If you haven’t already, check out our contributing guidelines for onboarding. To join our Slack channel, fill out this form.
Version Number: 9.5.28-5 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack: https://github.com/Expensify/App/pull/102261 Email or phone of affected tester (no customers): [email protected] Issue reported by: Applause Internal Team Bug source: Pull Request QA execution Device used: iPhone 13/18.6.2 App Component: Other
Action Performed:
- Launch Expensify app
- Log in with valid credentials
- Sign out of New Expensify.
- Open a real Expensify email containing an action link, such as an expense report email.
- Tap View on the expense report email.
Expected Result:
The app signs in and opens the linked report without displaying the offline message.
Actual Result:
Tapping the action link does not successfully sign in and open the linked report.
Workaround:
Unknown
Platforms:
- [ ] Android: App
- [ ] Android: mWeb Chrome
- [x] iOS: App
- [ ] iOS: mWeb Safari
- [ ] iOS: mWeb Chrome
- [ ] Windows: Chrome
- [ ] MacOS: Chrome Safari
Screenshots/Videos
https://github.com/user-attachments/assets/1245045a-e7a4-4ada-8bfe-3bb519f56999
Applause Internal Information Exported by: Julia Ponikarchuk Bug ID: 7303725
Upwork Automation - Do Not Edit
- Upwork Job URL: https://www.upwork.com/jobs/~022117640669203853917
- Upwork Job ID: 2117640669203853917
- Last Price Increase: 2026-11-03
Issue Owner
Current Issue Owner: @Ollyws
While Applause doesn't embed attachments for this bug, here are the links for quick view: https://platform.applause.com/services/links/v1/external/5ae127757e27b487e823afd7b03f1bfab578cd4023748d7d35eda5525a560882
This PR failing because of the issue #105778 This issue is reproducible in: iOS app
Investigating...
I reverted #102261 locally and the bug is still reproducible. So it's not the offending PR.
⚠️ Preliminary analysis (low confidence) — treat as a starting point, not a conclusion.
This bug is not caused by Show the offline message instead of a bare spinner on the magic link page. That PR is on staging but not production, and this issue also reproduces on production. The PR only changes what renders while offline. Online, FullPageOfflineBlockingView.tsx:37 returns the same spinner as before. The sign-in effects in ValidateLoginPage are unchanged.
I think the HybridApp sign-in gate is the likely cause. On HybridApp, AuthScreens only mount when hybridApp.readyToShowAuthScreens is true (AppNavigator.native.tsx:17). That flag is only set after credentials.autoGeneratedLogin, autoGeneratedPassword, account.requiresTwoFactorAuth, needsTwoFactorAuthSetup, and nvp_tryNewDot all arrive in Onyx (HybridApp.ts:98-125). A magic-link sign-in skips the normal email and code steps. If the SigninUserWithLink response leaves out any of those values, the app stays on the public screens, and the exitTo navigation never runs. Separately, if nvp_tryNewDot sends the user to Classic, NewDot closes without opening the report (HybridApp.ts:120-121).
That gate is shared with Android, so the iOS-only part may be in the native iOS HybridApp layer, outside the App repo. For example, the universal link may not reach NewDot while it is signed out.
I wasn't able to verify this because log search was unavailable in this run and I couldn't review the video. This bug only happens in the iOS app, so I didn't test it on web.
To confirm, check the logs for the affected tester around the repro time:
- Was
SigninUserWithLinksent, and did it succeed? If it wasn't sent, iOS never handed the link to NewDot. - If it succeeded, does
[HybridApp] Performing sign-in on OldDot sidefollow? If not, the gate above is blocking. - Does the video end on the sign-in page, a spinner, Classic, or Safari?
Smaller issues found along the way
isPublicScreenRoute.tsbuilds an anchored regex such as^v/\w+/\w+$. Av/...?exitTo=...route fails that match, soopenReportFromDeepLink(Link.ts:489-510) also callswaitForUserSignIn().waitForUserSignIn()keeps only one resolver (Session/index.ts:100). With two callers, one promise never resolves. That may drop theexitTonavigation fromhandleExitToNavigation. It is fragile, but probably not enough to cause this bug alone.
Next Steps: Reply with @MelvinBot <your feedback> to refine this analysis.
Current assignee @mkhutornyi is eligible for the External assigner, not assigning anyone new.
Job added to Upwork: https://www.upwork.com/jobs/~022117640669203853917
Proposal
Please re-state the problem that we are trying to solve in this issue.
After signing out on iOS, opening a valid report action link from an Expensify email reportedly fails to complete sign-in and display the linked report. The required behavior is successful authentication followed by navigation to that specific report while online.
What is the root cause of that problem?
Unverified. This case does not yet meet the required evidence standard for a submission-ready fix.
The supplied material contains no implementation, authentication trace, sanitized link structure, or failing automated test. No Expensify checkout exists in the workspace, and attempts to retrieve the relevant source and PR diff failed.
The official release notes identify PR #102261 as changing the magic-link page’s offline presentation. That establishes an investigation lead, not proof that it caused the authentication or navigation failure. Expensify release notes
The following remain unresolved:
- Does link validation execute, fail, or never start?
- Is connectivity actually reported as offline when the link opens?
- Does authentication succeed while the report destination is lost?
- Does the email URL contain authentication material, or require a separate authentication handoff?
- Does the failure reproduce before PR #102261?
Exact file paths, line numbers, and a causal explanation cannot responsibly be asserted without inspecting the affected revision.
What changes do you think we should make in order to solve the problem?
No defensible TypeScript diff can be specified from the available evidence. Inventing function names or changing an assumed connectivity guard would violate the audit requirements.
Before selecting a patch:
- Reproduce on version
9.5.28-5with a fresh, valid link and record whether the app was running or terminated. - Capture the sanitized URL structure, connectivity transitions, validation request/result, session transition, and final navigation destination. Redact authentication secrets.
- Compare the affected revision with PR #102261’s parent using equivalent fresh links.
- Encode the observed failure in a regression test, then change only the responsible branch.
A fix must demonstrate both successful authentication and navigation to the linked report. Removing an offline message alone does not establish either outcome.
What alternative solutions did you explore? (Optional)
No MelvinBot proposal was supplied, so there is no proposal to dismantle. Its authorship of the referenced PR does not establish a defect.
Reject these unsupported approaches:
- Remove the offline UI: could conceal the failure while leaving authentication stalled.
- Force connectivity to online: could break legitimate offline handling.
- Add unconditional retries: could duplicate validation attempts; token-consumption behavior must first be established.
- Navigate immediately: does not prove authentication or report access succeeded.
- Rewrite authentication or deep-link routing: introduces unjustified regression risk before the failing boundary is identified.
Duplicate and existing-fix status also remain unverified because the issue URL and current discussion were not supplied or retrieved.
What automated tests can you add to prevent this from re-occurring?
Proposed regression contract, not implemented or executed:
it('authenticates a signed-out user from a valid online report link and opens that report')
Using the affected revision’s existing Jest navigation/authentication harness:
- Initialize signed-out state after the normal sign-out flow.
- Deliver a report action-link fixture matching the real URL structure.
- Provide online connectivity and controlled successful authentication responses.
- Assert validation executes, the session becomes authenticated, and navigation resolves to the exact report ID.
- Assert no offline message appears while connectivity remains online.
Add cases for offline-to-online recovery, expired links, duplicate URL delivery, and authenticated users. The principal regression test must fail before the patch and pass afterward.
An iOS device reproduction is additionally required to verify universal-link delivery and app lifecycle behavior that mocked Jest tests cannot establish.
Contributor details
Your Expensify account email: [email protected]
Upwork Profile Link: https://www.upwork.com/freelancers/~01b60d704ba377be83
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the iOS app, after logging in and signing out of New Expensify, tapping View on a report action magic link from an email (.../v/<accountID>/<validateCode>?exitTo=r/<reportID>) does not complete navigation to the linked report after signing in.
What is the root cause of that problem?
When a signed-out user opens a magic link containing an exitTo query parameter (e.g. v/<accountID>/<validateCode>?exitTo=r/<reportID>), two bugs in the deep-link and session sign-in flow collide:
-
isPublicScreenRoutefails on public routes with query parameters (src/libs/isPublicScreenRoute.ts:3-8): When the deep link arrives viaDeepLinkHandler.tsx,openReportFromDeepLink(src/libs/actions/Link.ts:484-500) extractsroute = getRouteFromLink(url)("v/<accountID>/<validateCode>?exitTo=r/<reportID>") and checks:if (!isAuthenticated && isPublicScreenRoute(route)) { return; }However,
isPublicScreenRoutebuilds an end-anchored regex without stripping query strings or hashes:const routeRegex = new RegExp(`^${screenRoute.replaceAll(/:\w+/g, '\\w+')}$`); return routeRegex.test(route);Because
PUBLIC_SCREENS_ROUTES.VALIDATE_LOGINis'v/:accountID/:validateCode',^v/\w+/\w+$fails to match'v/<accountID>/<validateCode>?exitTo=r/<reportID>'. As a result,openReportFromDeepLinkdoes not return early at line 499 and instead proceeds to line 519 (waitForUserSignIn().then(...)). -
waitForUserSignIn()stores only a single resolver (src/libs/actions/Session/index.ts:100, 1657-1665): At the same time,ValidateLoginPage(src/pages/ValidateLoginPage/index.tsx:37) callssignInWithValidateCodeAndNavigate(Number(accountID), validateCode, preferredLocale, exitTo), which invokeshandleExitToNavigation(exitTo)(src/libs/actions/Session/index.ts:1667-1677) and callswaitForUserSignIn(). BecauseSession/index.ts:100stores only a single callback (let authPromiseResolver: ((value: boolean) => void) | null = null), having bothopenReportFromDeepLinkandhandleExitToNavigationcallwaitForUserSignIn()while signed out causes the second caller to overwriteauthPromiseResolver:- If
openReportFromDeepLinkoverwritesauthPromiseResolver(either on initial URL handling or whenDeepLinkHandler's effect re-runs asconciergeReportID/introSelectedhydrate during sign-in),handleExitToNavigation(exitTo)'s promise never resolves andexitTo(r/<reportID>) is never opened. - Instead,
openReportFromDeepLink's waiter runshandleDeeplinkNavigation()withdeeplinkRoute = "v/<accountID>/<validateCode>?exitTo=r/<reportID>"(a public route rather than the target report).
- If
What changes do you think we should make in order to solve the problem?
-
Strip query parameters and hash fragments in
src/libs/isPublicScreenRoute.ts: Normalize the route path before matching againstPUBLIC_SCREENS_ROUTESsov/:accountID/:validateCode?exitTo=...is properly recognized as a public screen route andopenReportFromDeepLinkexits early as intended:import {PUBLIC_SCREENS_ROUTES} from '@src/ROUTES'; export default function isPublicScreenRoute(route: string) { const routeWithoutQuery = route.split(/[?#]/).at(0) ?? ''; return Object.values(PUBLIC_SCREENS_ROUTES).some((screenRoute) => { const routeRegex = new RegExp(`^${screenRoute.replaceAll(/:\w+/g, '\\w+')}$`); return routeRegex.test(routeWithoutQuery); }); } -
Support multiple concurrent callers in
waitForUserSignIn()(src/libs/actions/Session/index.ts): Replace the singleauthPromiseResolvervariable with aSetof resolvers so concurrent callers (such ashandleExitToNavigationand any deep-link listeners) all resolve whendeprecatedSession.authTokenbecomes truthy:const authPromiseResolvers = new Set<(value: boolean) => void>();In the
ONYXKEYS.SESSIONcallback (src/libs/actions/Session/index.ts:113-116):if (deprecatedSession.authToken && authPromiseResolvers.size > 0) { for (const resolve of authPromiseResolvers) { resolve(true); } authPromiseResolvers.clear(); }And in
waitForUserSignIn()(src/libs/actions/Session/index.ts:1657-1665):function waitForUserSignIn(): Promise<boolean> { return new Promise<boolean>((resolve) => { if (deprecatedSession.authToken) { resolve(true); } else { authPromiseResolvers.add(resolve); } }); }
What alternative solutions did you explore? (Optional)
- Extracting
exitToinsideopenReportFromDeepLink: rejected becauseValidateLoginPagealready owns magic-link sign-in andexitTonavigation viasignInWithValidateCodeAndNavigate/handleExitToNavigation;openReportFromDeepLinkexplicitly intends to skip public routes at line 498.
What automated tests can you add to prevent this from re-occurring?
- Add unit tests for
isPublicScreenRouteverifying thatv/12345/67890?exitTo=r/98765returnstrue. - Add a unit test in
tests/unit/SessionTest.tsverifying that multiple concurrent calls towaitForUserSignIn()all resolve whenONYXKEYS.SESSIONreceives anauthToken.
Proposal
Please re-state the problem that we are trying to solve in this issue.
On iOS, when a signed-out user taps an email action link with an exitTo parameter (such as viewing an expense report: v/<accountID>/<validateCode>?exitTo=r/<reportID>), the app signs in with the magic link but fails to open the linked report.
What is the root cause of that problem?
There are two interacting defects in isPublicScreenRoute.ts and Session/index.ts:
-
isPublicScreenRoutefails to match URLs with Query Parameters (src/libs/isPublicScreenRoute.ts:3-8): Insrc/libs/actions/Link.ts(openReportFromDeepLink):if (!isAuthenticated && isPublicScreenRoute(route)) { return; }openReportFromDeepLinkintends to letValidateLoginPagehandle the magic link and subsequentexitTonavigation when the user is not authenticated. However,isPublicScreenRouteconstructs an end-anchored regex without stripping query strings:const routeRegex = new RegExp(`^${screenRoute.replaceAll(/:\w+/g, '\\w+')}$`); return routeRegex.test(route);For
v/<accountID>/<validateCode>?exitTo=r/<reportID>, the regex^v/\w+/\w+$fails because of?exitTo=.... As a result,openReportFromDeepLinkfails to exit early and proceeds to invokewaitForUserSignIn(). -
Single-Resolver Race in
waitForUserSignIn()(src/libs/actions/Session/index.ts:100, 1657-1665): Simultaneously,ValidateLoginPageprocesses the magic link and callshandleExitToNavigation(exitTo)(Session/index.ts:1667), which also callswaitForUserSignIn(). InSession/index.ts:let authPromiseResolver: ((value: boolean) => void) | null = null;Because only a single callback variable is maintained, concurrent calls to
waitForUserSignIn()fromopenReportFromDeepLinkandhandleExitToNavigationoverwriteauthPromiseResolver. WhendeprecatedSession.authTokenbecomes truthy, only one promise resolves:handleExitToNavigation's promise is dropped, so the user is never navigated to the linked report (r/<reportID>). Instead,openReportFromDeepLinkattempts to navigate to the magic-link route itself.
What changes do you think we should make in order to solve the problem?
-
Normalize Route in
src/libs/isPublicScreenRoute.ts: Strip query parameters and hash fragments before testing againstPUBLIC_SCREENS_ROUTES:import {PUBLIC_SCREENS_ROUTES} from '@src/ROUTES'; export default function isPublicScreenRoute(route: string) { const cleanRoute = route.split(/[?#]/)[0] ?? ''; return Object.values(PUBLIC_SCREENS_ROUTES).some((screenRoute) => { const routeRegex = new RegExp(`^${screenRoute.replaceAll(/:\w+/g, '\\w+')}$`); return routeRegex.test(cleanRoute); }); } -
Support Concurrent Listeners in
src/libs/actions/Session/index.ts: Replace the singletonauthPromiseResolverwith aSetof callbacks:const authPromiseResolvers = new Set<(value: boolean) => void>(); // In ONYXKEYS.SESSION listener: if (deprecatedSession.authToken && authPromiseResolvers.size > 0) { authPromiseResolvers.forEach((resolve) => resolve(true)); authPromiseResolvers.clear(); } // In waitForUserSignIn: function waitForUserSignIn(): Promise<boolean> { return new Promise<boolean>((resolve) => { if (deprecatedSession.authToken) { resolve(true); return; } authPromiseResolvers.add(resolve); }); }
What alternative solutions did you explore? (Optional)
- Parsing
exitToinsideopenReportFromDeepLink: HandlingexitToinopenReportFromDeepLinkwould duplicate the authentication handoff logic thatValidateLoginPagealready manages viasignInWithValidateCodeAndNavigate. AllowingisPublicScreenRouteto recognize routes with query parameters cleanly delegates magic-link authentication toValidateLoginPageas originally architected.
Automated Tests
- Unit tests for
isPublicScreenRoute:- Verify
v/12345/code?exitTo=r/999returnstrue. - Verify routes with query parameters and hash fragments (
v/123/code#test) returntrue.
- Verify
- Unit tests in
tests/unit/SessionTest.ts:- Verify that multiple concurrent calls to
waitForUserSignIn()while signed out all resolve successfully whenauthTokenis populated in Onyx.
- Verify that multiple concurrent calls to
Manual Tests
- On iOS, sign in to New Expensify and then explicitly sign out.
- Open an Expensify email containing a report action link (e.g. "View report").
- Tap the link to open the Expensify app.
- Verify that the app signs in and immediately opens the linked expense report.
Contributor details
Your Expensify account email: [email protected] Upwork Profile Link: https://www.upwork.com/freelancers/~0105126232377c4c5c
✅ Contributor details stored successfully. Thank you for contributing to Expensify!
Proposal
Please re-state the problem that we are trying to solve in this issue.
On iOS, when the user is signed out and taps a report link from an email notification (or a /v/<accountID>/<validateCode>?exitTo=r/<reportID> magic link), the app opens the sign-in screen or fails to land on the linked expense report.
What is the root cause of that problem?
Inspecting both attached screen recordings alongside the deep-link and HybridApp sign-in code reveals two distinct layers to this issue:
-
What happens in both attached videos (direct
/r/<reportID>links vs/v/<accountID>/<validateCode>magic links):- In the Applause recording (
0:17to0:26), the tester copies the"open it in Expensify"link from the"Please approve ARS 3,756.00 expense report"email and pastes it into Apple Notes. That email link ishttps://new.expensify.com/r/7454297444119905(a direct/r/<reportID>deep link with no/v/<accountID>/<validateCode>credentials). Because the user is signed out and the expense report is not a public room,openReportFromDeepLink(src/libs/actions/Link.ts:453-478) callsopenReport, unblocks the splash screen ontoSignInPage, and waits atwaitForUserSignIn()(line 519) for the user to sign in before opening the report. - Similarly, in
@mkhutornyi's Apple Notes recording (85fc0e8f...), the top URL (https://new.expensify.com/v/23472625/SNWFEYJTO?exitTo=/r/84514393167816) contains a line break beforeSNWFEYJTO, so iOS Notes only linkified the second URL (https://new.expensify.com//r/84514393167816/8385869340041982305), which was tapped at0:01and has novalidateCode.
- In the Applause recording (
-
Why a true
/v/<accountID>/<validateCode>?exitTo=/r/<reportID>magic link also fails to open the report when signed out on iOS:- Unstripped query string in
isPublicScreenRoute(src/libs/isPublicScreenRoute.ts:3-8):isPublicScreenRoute(route)testsnew RegExp('^v/\\w+/\\w+$')against the fullrouteincluding?exitTo=/r/<reportID>. Because?exitTo=...fails the$anchor,isPublicScreenRoutereturnsfalse, soopenReportFromDeepLink(src/libs/actions/Link.ts:498) does not return early. - Singleton
authPromiseResolveroverwrite + staleonboardingSubscriptioninLink.ts(src/libs/actions/Session/index.ts:100, 1657-1677andsrc/libs/actions/Link.ts:519-649): BecauseopenReportFromDeepLinkdoes not return early at line 498, bothopenReportFromDeepLink(Link.ts:519) andValidateLoginPage->handleExitToNavigation(Session/index.ts:1668) callwaitForUserSignIn().Session/index.ts:100stores only a singleauthPromiseResolver, so the second call overwrites the first resolver. Even ifopenReportFromDeepLinkwins the resolver, itsonboardingSubscription(Link.ts:570-648) subsequently executesNavigation.navigate(deeplinkRoute)wheredeeplinkRouteis the/v/<accountID>/<validateCode>?exitTo=...route itself rather than theexitToreport route. - HybridApp
readyToShowAuthScreenstiming (src/libs/Navigation/AppNavigator/AppNavigator.native.tsx:16-19andsrc/libs/HybridApp.ts:118-125): On iOS HybridApp, signing out callsresetSignInFlow(), which setshybridApp.useNewDotSignInPage = trueandhybridApp.readyToShowAuthScreens = false. WhenSigninUserWithLinksucceeds,session.authTokenupdates in Onyx beforeHybridApp.ts:119-124(setUseNewDotSignInPage(false).then(() => setReadyToShowAuthScreens(true))) completes its chainedOnyx.mergecalls, delaying<AuthScreens />mount iftryNewDotoraccountfields arrive in a later Onyx update.
- Unstripped query string in
What changes do you think we should make in order to solve the problem?
- In
src/libs/isPublicScreenRoute.ts, strip query parameters (?) and hash fragments (#) (and normalize leading/trailing slashes) before matching againstPUBLIC_SCREENS_ROUTESsov/<accountID>/<validateCode>?exitTo=...returnstrueandopenReportFromDeepLink(src/libs/actions/Link.ts:498) exits early, leavingValidateLoginPageas the sole handler of magic-link authentication andexitTonavigation. - In
src/libs/actions/Session/index.ts, replace the singletonlet authPromiseResolverwith aSet<(value: boolean) => void>()(matching the note inSession/index.ts:942) so concurrent callers ofwaitForUserSignIn()never drop each other's resolution. - In
src/libs/HybridApp.ts(signInToOldDotAndChooseExperience), merge{useNewDotSignInPage: false, readyToShowAuthScreens: true}in a single atomicOnyx.merge(ONYXKEYS.HYBRID_APP, ...)call when staying in NewDot instead of chainingsetUseNewDotSignInPage(false).then(() => setReadyToShowAuthScreens(true)).
What alternative solutions did you explore? (Optional)
- Having
openReportFromDeepLinkparseexitTodirectly was considered, butValidateLoginPagealready ownssignInWithValidateCodeAndNavigate(accountID, validateCode, preferredLocale, exitTo). MakingisPublicScreenRoutequery-aware preventsopenReportFromDeepLinkfrom competing withValidateLoginPage.
@mkhutornyi Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
Proposal
Please re-state the problem that we are trying to solve in this issue.
On the iOS app, when a signed-out user taps a report action magic link from an email (structured as .../v/<accountID>/<validateCode>?exitTo=r/<reportID>) while online, the app signs the user in (or fails to complete the magic link handoff) without navigating to the linked report r/<reportID>.
What is the root cause of that problem?
When a signed-out user opens a magic link containing an exitTo query parameter (v/<accountID>/<validateCode>?exitTo=r/<reportID>), two bugs in the deep-link handling flow collide:
- In
src/libs/actions/Link.tsinsideopenReportFromDeepLink(lines 484–500), the app extractsconst route = getRouteFromLink(url)(which produces"v/<accountID>/<validateCode>?exitTo=r/<reportID>") and checksif (!isAuthenticated && isPublicScreenRoute(route)) { return; }. - In
src/libs/isPublicScreenRoute.ts(lines 3–8),isPublicScreenRoute(route)testsrouteagainst end-anchored regular expressions (^v\/[^/]+\/[^/]+$) without stripping query parameters (?exitTo=...) first! Because?exitTo=r/<reportID>is still attached toroute,isPublicScreenRoute(route)returnsfalse! - Because
isPublicScreenRoute(route)returnsfalse,openReportFromDeepLinkdoes NOT return early for the unauthenticatedv/...magic link and instead proceeds to callnavigateToReportWithPolicyCheck({reportID}), which intercepts and clobbers theValidateLoginPageroute beforesignInWithValidateCodeAndNavigatecan authenticate the session and navigate toexitTo.
What changes do you think we should make in order to solve the problem?
- In
src/libs/isPublicScreenRoute.ts(lines 3–8), strip any query string (and hash) fromroutebefore matching against the public screen route patterns (e.g.const pathWithoutQuery = route.split('?')[0].split('#')[0];) sov/<accountID>/<validateCode>?exitTo=r/<reportID>is properly recognized as a public screen route. - Add a unit test in
tests/unit/isPublicScreenRouteTest.tsverifying thatisPublicScreenRoute('v/12345/654321?exitTo=r/98765')andisPublicScreenRoute('ug/12345/654321?exitTo=...')returntrue.
What alternative solutions did you explore? (Optional)
We considered stripping the query string inside openReportFromDeepLink in src/libs/actions/Link.ts before calling isPublicScreenRoute, but fixing isPublicScreenRoute directly in src/libs/isPublicScreenRoute.ts ensures every caller checking whether a URL/route is a public route handles query strings consistently.
📣 @jeffrey-graham! 📣 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:
- Make sure you've read and understood the contributing guidelines.
- 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>
Proposal
Please re-state the problem that we are trying to solve in this issue.
On iOS, clicking an online magic link while signed out authenticates the user but fails to navigate to the specific report specified in the link.
What is the root cause of that problem?
In src/libs/Navigation/AppNavigator/index.tsx and SignInPage.tsx:
- When opening a magic link URL (
/r/:reportID), the destination route is parsed and stored inexitToorlastVisitedPath. - On iOS native/Safari, the authentication callback clears URL parameters during credential exchange and redirects to the default home route (
ROUTES.HOME) beforeNavigation.navigatereads the storedexitToroute, discarding the deep-link destination.
What changes do you think we should make in order to solve the problem?
- In
Session.ts(signInWithValidateCode/validateSession):- Preserve the target deep-link route (
exitTo) in persistent Onyx storage across the entire authentication lifecycle.
- Preserve the target deep-link route (
- In
AppNavigator:- Upon successful session restoration, check if a stored destination route exists in Onyx. If present, navigate directly to that report route before clearing the key.
What alternative solutions did you explore? (Optional)
Relying on browser address bar history, but native iOS app transitions do not maintain web browser navigation history across authentication redirects.
@mkhutornyi 6 days overdue. This is scarier than being forced to listen to Vogon poetry!
@MelvinBot post proposal
Proposal
⚠️ Provisional — the reported iOS failure’s root cause remains unverified.
What is the root cause of that problem?
There is a confirmed classification defect: validation links containing ?exitTo=... fail the public-route matcher. This allows generic deep-link navigation to compete with the validation page’s authentication flow.
However, this does not establish why the reported iOS reproduction fails. A previous investigation says the recordings show direct report links, which cannot automatically authenticate a signed-out user. I could not independently verify those recordings.
Code evidence and limits
isPublicScreenRoute.ts:3–7matches the entire route without removing query parameters.Link.ts:498–519consequently registers an unnecessary sign-in waiter.Session/index.ts:1651–1680retains only one waiter. Losing the report destination depends on registration order; that order has not been demonstrated in the failing reproduction.
What changes do you think we should make in order to solve the problem?
Before selecting the issue’s fix, capture a fresh reproduction’s sanitized URL structure, whether SigninUserWithLink executes successfully, and the final destination. Never include validation codes or tokens.
If that confirms the classification defect causes the failure:
- Match only the pathname in the public-route helper, excluding query strings and fragments.
- Add regression tests covering validation links with
exitToand confirming they bypass generic deep-link authentication handling. - Verify successful authentication and navigation to the exact linked report.
The helper correction is independently justified, but is not yet a verified solution to this iOS issue.
What alternative solutions did you explore? (Optional)
- Support multiple sign-in waiters: useful hardening, but resolving both could preserve competing navigation handlers.
- Change HybridApp readiness flags or persist
exitTo: insufficient evidence supports either change. - Remove the offline message: would not repair authentication or navigation.
Verification: Read-only code investigation; no implementation or UI testing performed. A submission-ready fix remains blocked on confirming the actual failing link and authentication sequence.
@mkhutornyi this issue was created 2 weeks ago. Are we close to approving a proposal? If not, what's blocking us from getting this issue assigned? Don't hesitate to create a thread in #expensify-open-source to align faster in real time. Thanks!