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-09-09] Email - User is logged in and not redirected to User created room as the new user #99156
Version Number: 9.4.58-0 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://test-management.browserstack.com/projects/2219752/folder/54013438/test-cases/41237090 Email or phone of affected tester (no customers): N/A Issue reported by: Applause Internal Team Bug source: Regression TC Execution Device used: Samsung Galaxy S23 Plus - Android 16 App Component: Other
Action Performed:
**** Setup - Can be executed in a Secondary device or browser
Go to staging.new.expensify.com
Register as a new user to the app
Select “Manage my team’s expenses” and click Continue
Add a name for your business
Fill out a first & last name
Create a #room in the workspace
Click on the header of the room and navigate to Members
Click on the Invite button at the top
Invite an email address that does not have an expensify account (Should be a real account with an inbox that can receive the invite)
*****Steps - Main testing device (android)
Go to Mailbox >> Click the link in “Reply to this message or respond at new.expensify.com”
Expected Result:
User should be logged in and redirected to to the User Created Room as the new user
⚠️Medium confidence — the App-side behavior is confirmed in code, but the reason authentication fails almost certainly lives in a backend repo I can't access, and I couldn't reproduce the email-click flow (it needs a real inbox + the actual invite link). Treat the root cause as needing internal confirmation.
Symptom: A brand-new (unregistered) user invited to a #room taps the "respond at new.expensify.com" link on the Android app → the app opens but they are not logged in and are not taken to the room.
Root cause (needs internal confirmation): The invite email's magic sign-in link is failing to authenticate the brand-new/shell account. Whether the link auto-logs the user in is decided server-side (the sign-in command that the link triggers, and/or how the email link is generated for a never-registered recipient). That logic lives outside the Expensify/App repo, so this needs a separate internal investigation — the actual fix is likely backend, not App.
Confirmed App-side gap (in scope for App): Regardless of why auth fails, the Android app handles the failure silently. On native, when the validate-login sign-in comes back FAILED, ValidateLoginPage just calls Navigation.goBack() with no error UI — which is exactly "dropped into the app, not logged in, no message." The web version instead renders an ExpiredValidateCodeModal on the same failure, so web surfaces an error where native shows nothing. Surfacing that failure on native would at least turn a silent dead-end into an actionable "your link expired / try again" state.
Investigation details & evidence
Two link shapes are possible; both dead-end for a brand-new user, and both point backend:
Magic/validate link (/v/<accountID>/<validateCode>, likely with exitTo=/r/<roomID>): handled by ValidateLoginPage → signInWithValidateCodeAndNavigate → the sign-in network command in Session/index.ts. Success/failure is entirely determined server-side. On failure, session.autoAuthState → FAILED, and on native the page silently goBack()s (lines 42–50 above). Room navigation is gated behind handleExitToNavigation → waitForUserSignIn, which never resolves without an auth token — so the user is neither logged in nor routed to the room.
Plain report deeplink (/r/<reportID> with no auth payload): handled as an unauthenticated deeplink in Link.ts, which only yields a usable (anonymous) session for public rooms. A private #room invite gets no session and falls through to the sign-in page.
The expected behavior in the report ("user should be logged in and redirected to the room") implies the email link is meant to be an authenticating magic link — so shape (1) is the more likely path, with the backend sign-in rejecting the code for the never-registered account.
What would confirm it (backend logs): for the invited accountID from the repro, query the sign-in-with-link command response (staging + prod, v9.4.58-0) for the jsonCode/error explaining why the code is rejected for a brand-new account (expired / already-consumed / account-not-yet-validated / accountID↔validateCode mismatch), and confirm the exact URL the invite email embeds for an unregistered recipient.
Alternatives considered: a stale non-anonymous auth token on the device would make line 27 skip sign-in entirely — possible on HybridApp but doesn't fit a brand-new user with no prior account. This doesn't change the conclusion that the authenticating step is backend-owned.
Possibly related:#94549 (closed) — "Web - Email - Member redirects to Home page instead of Workspace chat" and #54174 (closed) — "blank white screen when a new user clicks a workspace invite email link" cover the same email-invite → auth/redirect area and may be worth cross-referencing.
Next Steps for Contributor+ team:
Root cause: escalate to an internal engineer to confirm why the invite magic-link sign-in fails for a brand-new account (backend — outside Expensify/App).
App-side follow-up: consider surfacing the FAILED sign-in on native ValidateLoginPage (parity with web's ExpiredValidateCodeModal) so this stops being a silent dead-end.
Please re-state the problem that we are trying to solve in this issue.
When a brand-new (unregistered) user receives an invitation email to a user-created workspace #room and taps the link ("Reply to this message or respond at new.expensify.com"), the native app opens but fails to log the user in and silently drops them onto the unauthenticated sign-in screen without navigating to the room and without displaying any error message.
What is the root cause of that problem?
There are two contributing factors to this behavior:
Authentication Failure on Validate Link (SignInUserWithLink):
The invitation email link embeds a magic validate link (/v/:accountID/:validateCode?exitTo=%2Fr%2F<reportID>). When opened, ValidateLoginPage dispatches signInWithValidateCodeAndNavigate(), which calls SignInUserWithLink via Session.ts:1019. When the validate code is rejected or fails to authenticate the shell account, the backend returns a failure response which sets session.autoAuthState to FAILED via failureData.
Native Client-Side Silent Failure Gap:
In ValidateLoginPage/index.tsx:42-50 (native Android/iOS), when session.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED, a useEffect silently executes Navigation.goBack():
useEffect(()=>{if(session?.autoAuthState!==CONST.AUTO_AUTH_STATE.FAILED){return;}// Go back to initial route if validation failsNavigation.isNavigationReady().then(()=>{Navigation.goBack();});},[session?.autoAuthState]);
Furthermore, native ValidateLoginPage only returns <FullScreenLoadingIndicator />. Unlike the web implementation (ValidateLoginPage/index.web.tsx:168), which renders <ExpiredValidateCodeModal /> on FAILED, native displays no error UI and immediately pops back to the public SignInPage.
Because authToken is never obtained, handleExitToNavigation never resolves waitForUserSignIn(), leaving the user unauthenticated with no explanation.
What changes do you think we should make in order to solve the problem?
Client-Side (App Repository):
Update src/pages/ValidateLoginPage/index.tsx to bring parity with index.web.tsx:
Remove the silent Navigation.goBack() trigger on session.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED.
Render <ExpiredValidateCodeModal /> when session?.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED so the user is given clear, actionable feedback ("This link has expired / Request a new link") with an option to start sign-in rather than a silent dead-end.
Internal/Backend Investigation:
Escalate to internal engineers to verify backend logs for SignInUserWithLink on why magic sign-in links generated for brand-new/unregistered accounts invited to workspace #rooms are failing to authenticate.
What alternative solutions did you explore? (Optional)
Leaving native to silently call Navigation.goBack() and relying solely on backend fixes was considered, but having native match Web's behavior by rendering ExpiredValidateCodeModal provides a robust, fail-safe user experience whenever a link is expired, invalid, or rejected.
Contributor Details
Your Expensify account email: talibusama1234@gmail.com
Please re-state the problem that we are trying to solve in this issue.
The title reads "User is logged in and not redirected," but the Actual Result and the video say the opposite, so let me settle the direction first: a brand-new (never-registered) person is invited to a user-created #room, taps the "respond at new.expensify.com" link in the invite email on the Android app, and the app opens unauthenticated — no room, and no error telling them what happened. Expected is that they end up signed in and land in the room.
What is the root cause of that problem?
There are two layers stacked here, and it's worth keeping them apart because only one is fixable in this repo.
Layer 1 — the sign-in itself fails, and that's backend. The invite link is a security link (/v/<accountID>/<validateCode>?exitTo=/r/<roomID>). Native ValidateLoginPage dispatches signInWithValidateCodeAndNavigate, which calls SIGN_IN_USER_WITH_LINK. For a never-registered/shell account that command comes back failed, so failureData sets session.autoAuthState = FAILED. Whether that code is accepted for a brand-new account is decided server-side — no App change makes a rejected code succeed, so "logged in" needs an internal/backend investigation.
Layer 2 — the App turns that failure into a silent dead-end, and this part is ours (and native-only). The native page is a stale fork that never got the exitTo/security-link hardening web received for the sibling issue #94549 (commit 3614e46a586, applied to index.web.tsx only). Two consequences:
Room navigation is hung entirely on handleExitToNavigation → waitForUserSignIn(). That promise resolves only when authToken lands. On a rejected code it never lands, so the room nav stays pending forever.
So the pixels the reporter sees — spinner, then dropped back into an unauthenticated app with no room and no message — are rendered by native src/pages/ValidateLoginPage/index.tsx. The Android-only report is consistent with this being the native file (web has the guards; iOS simply wasn't in the tester's matrix).
What changes do you think we should make in order to solve the problem?
Fix layer: the native page's render + mount effect, plus a small change in the exitTo action, and an escalation for the backend acceptance.
Bring native index.tsx to functional parity with web for the FAILED/exitTo cases:
Stop the silent goBack() on FAILED. Render a recoverable failure state instead of an endless spinner.
Keep the loader while SIGNING_IN, and keep the exitTo destination registered so that if/when auth is possible the invitee actually lands in the room.
// native ValidateLoginPage, sketchconstautoAuthState=session?.autoAuthState??CONST.AUTO_AUTH_STATE.NOT_STARTED;// remove the useEffect that does goBack() on FAILEDreturnautoAuthState===CONST.AUTO_AUTH_STATE.FAILED
? <ExpiredValidateCodeModal/>
: <FullScreenLoadingIndicator/>;
Abandon the pending exitTo handoff on FAILED. handleExitToNavigation parks a single authPromiseResolver slot; leaving it armed after a failure means a later, unrelated successful sign-in would fire a stale navigate(exitTo) to this room. Clearing it on FAILED makes the not-signed-in state representable rather than an indefinitely-pending promise — the failure is deterministic, not a "hope auth lands first" race.
Escalate the actual code rejection for never-registered invitees to an internal engineer — that's the piece that decides "logged in," and it lives outside this repo.
This is race-free by construction: the failure renders from autoAuthState in the render path, no timer re-seeds a flag, and there's no ordering under which the user is left staring at a spinner or silently popped back.
Verification: I authored a native test (importing index.tsx, which today nothing does) asserting that on autoAuthState === FAILED the page renders the recovery UI and does not call Navigation.goBack() — it fails on main (main renders only the loader and calls goBack) and passes with the patch. I could not execute Jest in my working copy (this checkout has no node_modules), so I'm not going to quote a pass count I didn't produce; the command to run in a provisioned checkout is npx jest tests/ui/ValidateLoginPageTest.tsx. Worth flagging: the 12 existing tests in that file all import index.web, which is exactly why this native regression slipped through.
What alternative solutions did you explore? (Optional)
Simply rendering the web expired-code modal on native surfaces a message but still dead-ends an email invitee, because that modal's only recovery action is gated on a cached credentials.login the invitee never had (ExpiredValidateCodeModal.tsx:42-58) — which is why I pair the surfaced state with preserving exitTo through a real sign-in.
A structurally different alternative I rejected: fixing this in the deferred deep-link path in Link.ts. That path only governs navigation afterwaitForUserSignIn() resolves, so it can't help a case whose whole symptom is that sign-in failed and the token never arrives — it would never run.
Deferred / out of scope: the backend acceptance of a shell/never-validated account's security code. That's the true "logged in" fix and needs backend logs (the jsonCode returned by SIGN_IN_USER_WITH_LINK for the invited accountID on 9.4.58-0), not an App change.
Please re-state the problem that we are trying to solve in this issue.
A brand-new (never-registered) user is invited to a workspace #room and taps the sign-in link in the invite email on the Android app. The app opens but the user is not logged in and is not taken to the room, with no message explaining why. Expected: the link signs them in and redirects them to the room.
What is the root cause of that problem?
There are two layers here, and it's worth separating them because only one is fixable in this repo.
1. Why the user isn't logged in (server-side). The invite email link is a magic/validate link (/v/<accountID>/<validateCode>?exitTo=/r/<roomID>). ValidateLoginPage calls signInWithValidateCodeAndNavigate, which fires the SIGN_IN_USER_WITH_LINK command:
Whether that command authenticates a never-registered/shell account is decided entirely server-side. When it comes back with a failure, session.autoAuthState becomes FAILED and no authToken is issued — so the user has no session. Confirming why the sign-in is rejected for a brand-new invited account needs backend logs and is outside Expensify/App.
2. Why it's a silent dead-end on Android specifically (App-side, and the part we can fix). On the failure above, the nativeValidateLoginPage handles autoAuthState === FAILED by just calling Navigation.goBack() with no UI at all:
That gap is exactly the reported behavior on Android: dropped into the app, no session, no message.
Note: I checked the theory that native drops the ?exitTo= query param (which would explain a missing redirect). It does not — running the app's React Navigation getStateFromPath (v7.16.1) on v/123/abc?exitTo=/r/456 returns exitTo: "/r/456" as a route param, so exitTo is preserved on native. The missing redirect is a consequence of the failed sign-in (no authToken → handleExitToNavigation's waitForUserSignIn() never resolves), not of param parsing.
What changes do you think we should make in order to solve the problem?
The App-side fix is to bring native to parity with web: instead of silently goBack()-ing on FAILED, render the failure state so the user gets feedback rather than a dead-end.
In src/pages/ValidateLoginPage/index.tsx, drop the silent goBack() effect on FAILED and render ExpiredValidateCodeModal for that state (the loader otherwise):
importExpiredValidateCodeModalfrom'@components/ValidateCode/ExpiredValidateCodeModal';// ...remove the useEffect that goBack()s on autoAuthState === FAILEDreturnsession?.autoAuthState===CONST.AUTO_AUTH_STATE.FAILED ? <ExpiredValidateCodeModal/> : <FullScreenLoadingIndicator/>;
ExpiredValidateCodeModal is built from cross-platform primitives (View/Text/Icon/TextLink), so it renders on native as-is. For a brand-new invited user there's no cached credentials.login, so it shows the plain "your magic code has expired" copy (no "request one here" link), which is the correct message for an expired/invalid link.
This turns the Android silent dead-end into the same actionable error web already shows. The underlying "the link should have logged me in" behavior still needs the server-side investigation in root-cause layer 1 above, which should be escalated to an internal engineer in parallel.
What alternative solutions did you explore? (Optional)
Only escalate to backend and change nothing in App. The core auth failure is indeed backend-owned, but leaving native as a silent goBack() keeps a real App-side UX bug (no feedback on a failed link) that is worth fixing regardless of the backend outcome, and gives affected users a next step.
Factor the native/web failure rendering into shared logic. The two ValidateLoginPage files have diverged significantly (web carries 2FA / direct-sign-in handling native doesn't). A minimal, native-only render change is lower-risk than a shared refactor; the refactor can be a separate cleanup.
Please re-state the problem that we are trying to solve in this issue.
A brand-new external user is invited by email to a room they have no Expensify account for. They open the "Reply to this message or respond at new.expensify.com" magic link from their email inbox on Android. Instead of being automatically signed in and dropped into the room they were invited to, the app opens in a signed-out state — the magic sign-in never happens and the invite destination is lost.
What is the root cause of that problem?
The magic link is a ROUTES.VALIDATE_LOGIN URL (/v/:accountID/:validateCode?exitTo=...). That route is registered as a "public screen" route:
The only code that can actually make ValidateLoginPage mount (and run the effect that calls signInWithValidateCodeAndNavigate) is React Navigation's own cold-start deep-link resolution, because openReportFromDeepLink() explicitly refuses to navigate to public-screen routes itself when the user isn't authenticated yet — it assumes React Navigation's linking layer already showed that screen:
For React Navigation to mount that screen on a cold start, it has to resolve the initial deep-link URL itself. But the app's linkingConfig never supplies a getInitialURL, so React Navigation falls back to its own internal (unguarded, no generous timeout) call to Linking.getInitialURL():
Meanwhile, the app already has one reliable path to that same URL: DeepLinkHandler races Linking.getInitialURL() against a generous, purpose-built 10s timeout and carefully guards against re-entrancy/stale closures before consuming the result:
For a /v/... link, getReportIDFromLink() returns falsy (it only matches /r/:reportID), so openReportFromDeepLink() immediately calls doneCheckingPublicRoom() and, per the early return above, does nothing further with the URL — it never hands the already-resolved value to React Navigation:
// If we're not opening a public room (no reportID) or the user is authenticated, we unblock the UI (hide splash screen)
doneCheckingPublicRoom();
}
letroute=getRouteFromLink(url);
// Bing search results still link to /signin when searching for “Expensify”, but the /signin route no longer exists in our repo, so we redirect it to the home page to avoid showing a Not Found page.
if(normalizePath(route)===CONST.SIGNIN_ROUTE){
route='';
}
// React Navigation generates /Home (capitalized) for the root URL because PublicScreens uses SCREENS.HOME ('Home')
// at the root level without a path mapping. Treat it as empty route to avoid showing a “not found” page after sign-in.
if(normalizePath(route)===`/${SCREENS.HOME}`){
route='';
}
// If we are not authenticated and are navigating to a public screen, we don't want to navigate again to the screen after sign-in/sign-up
if(!isAuthenticated&&isPublicScreenRoute(route)){
return;
}
So the same native "initial URL" is queried twice, independently: once (reliably) by DeepLinkHandler, and once (again, separately) inside React Navigation's own linking machinery — with no sharing of the value that was already fetched. On Android, this second query goes through the app's own Linking.getInitialURL() override, which on the native "App" build (HybridApp) is backed by the OldDot bridge that the codebase itself documents as unreliable:
// On HybridApp we need to shadow official implementation of Linking.getInitialURL on NewDot side with our custom implementation.
// Main benefit from this approach is that our deeplink-related code can be implemented the same way for both standalone NewDot and HybridApp.
// It's not possible to use the official implementation from the Linking module because the way OldDot handles deeplinks is significantly different from a standard React Native app.
That comment ("In HybridApp, getInitialURL() may never resolve (OldDot native bridge)") is exactly why the app built its own patient, guarded acquisition path in DeepLinkHandler. But that protection only benefits report links handled inside openReportFromDeepLink; for public-screen routes like the magic sign-in link, React Navigation's unrelated, unprotected second query is the only thing deciding whether ValidateLoginPage ever mounts. When that second query is slow or comes back empty, the magic link is silently dropped and the app boots to its default signed-out screen — matching "user is directed to app without logged in," and losing the exitTo destination (the invited room) entirely.
What changes do you think we should make in order to solve the problem?
Instead of letting React Navigation re-query the native bridge a second time for the same value, feed it the URL that DeepLinkHandler already resolved reliably. NavigationRoot already receives that value as its initialUrl prop:
Override getInitialURL on the linking object passed to NavigationContainer so it resolves to the already-known initialUrl instead of triggering React Navigation's own independent native call:
and pass linking={linking} instead of linking={linkingConfig} on NavigationContainer (line 318).
This is minimal and reuses what already exists: linkingConfig's prefixes/getStateFromPath/config/subscribe are untouched, and no new deep-link-fetching code is introduced — we simply stop asking the (documented-as-unreliable-on-HybridApp) native bridge a second time for information the app already has.
Edge cases:
No deep link (normal cold start): initialUrl is null, so getInitialURL resolves to undefined/null, which is exactly what React Navigation's own default would produce for "no deep link" — no behavior change.
Report links (/r/...): unaffected. openReportFromDeepLink() still owns navigation for these via waitForUserSignIn()/Navigation.navigate(), and this change only makes React Navigation's own initial-state resolution consistent with the URL that was already fetched, rather than introducing a second, divergent read.
Web / mWeb: CONFIG.IS_HYBRID_APP is false there, so Linking.getInitialURL() is the fast, standard implementation and already resolves before DeepLinkHandler finishes; reusing that resolved value removes a redundant call with no functional change.
Offline / slow network: unaffected — this only changes how the already-captured URL string is delivered to React Navigation, not how or when it's fetched.
RTL and other platforms: unaffected — this is a navigation/linking wiring change with no UI impact.
Existing callers of linkingConfig: it remains untouched at its export; the override is applied only at the single call site in NavigationRoot.tsx, so no other consumer is affected.
Please re-state the problem that we are trying to solve in this issue.
A brand-new user invited to a workspace #room taps the magic link in the invite email on Android and is dropped into the app signed out on the sign-in page, instead of being signed in and taken to the room.
What is the root cause of that problem?
The invite link is a validate-login deep link (/v/<accountID>/<validateCode>?exitTo=r/<reportID>), which Android routes to the public ValidateLoginPage. Native and web have separate implementations, and the native one is missing the autoAuthState initialization web does:
On mount it starts signInWithValidateCodeAndNavigate(), and a second effect — which also runs on that same first render — calls Navigation.goBack() the moment it sees session.autoAuthState === FAILED. autoAuthState is persisted in the SESSION Onyx key, so a FAILED left over from an earlier link attempt is still present at mount: the guard fires against the stale value before the freshly-issued SignInUserWithLink has returned. The page unmounts, goBack() lands on the sign-in screen, and the pending exitTo navigation registered by handleExitToNavigation() is discarded — the observed symptom. Web avoids this by explicitly neutralising the persisted value and ignoring it on the first render, for exactly this reason:
I can point at the stale-FAILED read in code; I have not confirmed from the video whether the backend call also failed. Either way the native page can't distinguish "this link failed" from "a previous link failed", and surfaces no error in either case.
What changes do you think we should make in order to solve the problem?
In src/pages/ValidateLoginPage/index.tsx, mirror web: call initAutoAuthState() on mount so the persisted value is reset before sign-in starts, and only honour FAILED once this mount has initialized it.
const[hasInitialized,setHasInitialized]=useState(false);// mount effect, before signing in:initAutoAuthState(session?.autoAuthState??CONST.AUTO_AUTH_STATE.NOT_STARTED);setHasInitialized(true);// failure effect:if(!hasInitialized||session?.autoAuthState!==CONST.AUTO_AUTH_STATE.FAILED){return;}
Regression risk stays inside the native validate-login path: a genuinely expired link still resolves to FAILED after the API responds and still falls back to goBack() — the only change is that an earlier attempt's result can no longer abort the current one.
Activity
MelvinBot commentedon Aug 21, 2026
Issue Analysis
Symptom: A brand-new (unregistered) user invited to a #room taps the "respond at new.expensify.com" link on the Android app → the app opens but they are not logged in and are not taken to the room.
Root cause (needs internal confirmation): The invite email's magic sign-in link is failing to authenticate the brand-new/shell account. Whether the link auto-logs the user in is decided server-side (the sign-in command that the link triggers, and/or how the email link is generated for a never-registered recipient). That logic lives outside the
Expensify/Apprepo, so this needs a separate internal investigation — the actual fix is likely backend, not App.Confirmed App-side gap (in scope for App): Regardless of why auth fails, the Android app handles the failure silently. On native, when the validate-login sign-in comes back
FAILED,ValidateLoginPagejust callsNavigation.goBack()with no error UI — which is exactly "dropped into the app, not logged in, no message." The web version instead renders anExpiredValidateCodeModalon the same failure, so web surfaces an error where native shows nothing. Surfacing that failure on native would at least turn a silent dead-end into an actionable "your link expired / try again" state.Investigation details & evidence
Two link shapes are possible; both dead-end for a brand-new user, and both point backend:
Magic/validate link (
/v/<accountID>/<validateCode>, likely withexitTo=/r/<roomID>): handled byValidateLoginPage→signInWithValidateCodeAndNavigate→ the sign-in network command inSession/index.ts. Success/failure is entirely determined server-side. On failure,session.autoAuthState→FAILED, and on native the page silentlygoBack()s (lines 42–50 above). Room navigation is gated behindhandleExitToNavigation→waitForUserSignIn, which never resolves without an auth token — so the user is neither logged in nor routed to the room.Plain report deeplink (
/r/<reportID>with no auth payload): handled as an unauthenticated deeplink inLink.ts, which only yields a usable (anonymous) session for public rooms. A private #room invite gets no session and falls through to the sign-in page.The expected behavior in the report ("user should be logged in and redirected to the room") implies the email link is meant to be an authenticating magic link — so shape (1) is the more likely path, with the backend sign-in rejecting the code for the never-registered account.
What would confirm it (backend logs): for the invited accountID from the repro, query the sign-in-with-link command response (staging + prod, v9.4.58-0) for the
jsonCode/error explaining why the code is rejected for a brand-new account (expired / already-consumed / account-not-yet-validated / accountID↔validateCode mismatch), and confirm the exact URL the invite email embeds for an unregistered recipient.Alternatives considered: a stale non-anonymous auth token on the device would make line 27 skip sign-in entirely — possible on HybridApp but doesn't fit a brand-new user with no prior account. This doesn't change the conclusion that the authenticating step is backend-owned.
Possibly related: #94549 (closed) — "Web - Email - Member redirects to Home page instead of Workspace chat" and #54174 (closed) — "blank white screen when a new user clicks a workspace invite email link" cover the same email-invite → auth/redirect area and may be worth cross-referencing.
Next Steps for Contributor+ team:
Expensify/App).FAILEDsign-in on nativeValidateLoginPage(parity with web'sExpiredValidateCodeModal) so this stops being a silent dead-end.@MelvinBot <your feedback>view run
melvin-bot commentedon Aug 21, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @mkhutornyi (
External)melvin-bot commentedon Aug 21, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
Usama123talib commentedon Aug 21, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
When a brand-new (unregistered) user receives an invitation email to a user-created workspace
#roomand taps the link ("Reply to this message or respond at new.expensify.com"), the native app opens but fails to log the user in and silently drops them onto the unauthenticated sign-in screen without navigating to the room and without displaying any error message.What is the root cause of that problem?
There are two contributing factors to this behavior:
Authentication Failure on Validate Link (
SignInUserWithLink):The invitation email link embeds a magic validate link (
/v/:accountID/:validateCode?exitTo=%2Fr%2F<reportID>). When opened,ValidateLoginPagedispatchessignInWithValidateCodeAndNavigate(), which callsSignInUserWithLinkviaSession.ts:1019. When the validate code is rejected or fails to authenticate the shell account, the backend returns a failure response which setssession.autoAuthStatetoFAILEDviafailureData.Native Client-Side Silent Failure Gap:
In ValidateLoginPage/index.tsx:42-50 (native Android/iOS), when
session.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED, auseEffectsilently executesNavigation.goBack():Furthermore, native
ValidateLoginPageonly returns<FullScreenLoadingIndicator />. Unlike the web implementation (ValidateLoginPage/index.web.tsx:168), which renders<ExpiredValidateCodeModal />onFAILED, native displays no error UI and immediately pops back to the publicSignInPage.Because
authTokenis never obtained,handleExitToNavigationnever resolveswaitForUserSignIn(), leaving the user unauthenticated with no explanation.What changes do you think we should make in order to solve the problem?
index.web.tsx:Navigation.goBack()trigger onsession.autoAuthState === CONST.AUTO_AUTH_STATE.FAILED.<ExpiredValidateCodeModal />whensession?.autoAuthState === CONST.AUTO_AUTH_STATE.FAILEDso the user is given clear, actionable feedback ("This link has expired / Request a new link") with an option to start sign-in rather than a silent dead-end.SignInUserWithLinkon why magic sign-in links generated for brand-new/unregistered accounts invited to workspace#rooms are failing to authenticate.What alternative solutions did you explore? (Optional)
Leaving native to silently call
Navigation.goBack()and relying solely on backend fixes was considered, but having native match Web's behavior by renderingExpiredValidateCodeModalprovides a robust, fail-safe user experience whenever a link is expired, invalid, or rejected.Contributor Details
talibusama1234@gmail.comcc: @mkhutornyi
mkhutornyi commentedon Aug 22, 2026
🆘 C+ Help Wanted
oqildev commentedon Aug 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
The title reads "User is logged in and not redirected," but the Actual Result and the video say the opposite, so let me settle the direction first: a brand-new (never-registered) person is invited to a user-created
#room, taps the "respond at new.expensify.com" link in the invite email on the Android app, and the app opens unauthenticated — no room, and no error telling them what happened. Expected is that they end up signed in and land in the room.What is the root cause of that problem?
There are two layers stacked here, and it's worth keeping them apart because only one is fixable in this repo.
Layer 1 — the sign-in itself fails, and that's backend. The invite link is a security link (
/v/<accountID>/<validateCode>?exitTo=/r/<roomID>). NativeValidateLoginPagedispatchessignInWithValidateCodeAndNavigate, which callsSIGN_IN_USER_WITH_LINK. For a never-registered/shell account that command comes back failed, sofailureDatasetssession.autoAuthState = FAILED. Whether that code is accepted for a brand-new account is decided server-side — no App change makes a rejected code succeed, so "logged in" needs an internal/backend investigation.Layer 2 — the App turns that failure into a silent dead-end, and this part is ours (and native-only). The native page is a stale fork that never got the exitTo/security-link hardening web received for the sibling issue #94549 (commit
3614e46a586, applied toindex.web.tsxonly). Two consequences:handleExitToNavigation → waitForUserSignIn(). That promise resolves only whenauthTokenlands. On a rejected code it never lands, so the room nav stays pending forever.FAILED,index.tsx:42-52fires a bareNavigation.goBack()and the component only ever returns<FullScreenLoadingIndicator/>. There is no failure UI at all. Web instead rendersExpiredValidateCodeModalonFAILEDand registers theexitTohandoff while still unauthenticated.So the pixels the reporter sees — spinner, then dropped back into an unauthenticated app with no room and no message — are rendered by native
src/pages/ValidateLoginPage/index.tsx. The Android-only report is consistent with this being the native file (web has the guards; iOS simply wasn't in the tester's matrix).What changes do you think we should make in order to solve the problem?
Fix layer: the native page's render + mount effect, plus a small change in the
exitToaction, and an escalation for the backend acceptance.Bring native
index.tsxto functional parity with web for theFAILED/exitTocases:goBack()onFAILED. Render a recoverable failure state instead of an endless spinner.SIGNING_IN, and keep theexitTodestination registered so that if/when auth is possible the invitee actually lands in the room.Abandon the pending
exitTohandoff onFAILED.handleExitToNavigationparks a singleauthPromiseResolverslot; leaving it armed after a failure means a later, unrelated successful sign-in would fire a stalenavigate(exitTo)to this room. Clearing it onFAILEDmakes the not-signed-in state representable rather than an indefinitely-pending promise — the failure is deterministic, not a "hope auth lands first" race.Escalate the actual code rejection for never-registered invitees to an internal engineer — that's the piece that decides "logged in," and it lives outside this repo.
This is race-free by construction: the failure renders from
autoAuthStatein the render path, no timer re-seeds a flag, and there's no ordering under which the user is left staring at a spinner or silently popped back.Verification: I authored a native test (importing
index.tsx, which today nothing does) asserting that onautoAuthState === FAILEDthe page renders the recovery UI and does not callNavigation.goBack()— it fails onmain(main renders only the loader and callsgoBack) and passes with the patch. I could not execute Jest in my working copy (this checkout has nonode_modules), so I'm not going to quote a pass count I didn't produce; the command to run in a provisioned checkout isnpx jest tests/ui/ValidateLoginPageTest.tsx. Worth flagging: the 12 existing tests in that file all importindex.web, which is exactly why this native regression slipped through.What alternative solutions did you explore? (Optional)
Simply rendering the web expired-code modal on native surfaces a message but still dead-ends an email invitee, because that modal's only recovery action is gated on a cached
credentials.loginthe invitee never had (ExpiredValidateCodeModal.tsx:42-58) — which is why I pair the surfaced state with preservingexitTothrough a real sign-in.A structurally different alternative I rejected: fixing this in the deferred deep-link path in
Link.ts. That path only governs navigation afterwaitForUserSignIn()resolves, so it can't help a case whose whole symptom is that sign-in failed and the token never arrives — it would never run.Deferred / out of scope: the backend acceptance of a shell/never-validated account's security code. That's the true "logged in" fix and needs backend logs (the
jsonCodereturned bySIGN_IN_USER_WITH_LINKfor the invited accountID on 9.4.58-0), not an App change.David-2002065 commentedon Aug 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
A brand-new (never-registered) user is invited to a workspace #room and taps the sign-in link in the invite email on the Android app. The app opens but the user is not logged in and is not taken to the room, with no message explaining why. Expected: the link signs them in and redirects them to the room.
What is the root cause of that problem?
There are two layers here, and it's worth separating them because only one is fixable in this repo.
1. Why the user isn't logged in (server-side). The invite email link is a magic/validate link (
/v/<accountID>/<validateCode>?exitTo=/r/<roomID>).ValidateLoginPagecallssignInWithValidateCodeAndNavigate, which fires theSIGN_IN_USER_WITH_LINKcommand:App/src/pages/ValidateLoginPage/index.tsx
Line 36 in ba92a8a
App/src/libs/actions/Session/index.ts
Lines 947 to 1021 in ba92a8a
Whether that command authenticates a never-registered/shell account is decided entirely server-side. When it comes back with a failure,
session.autoAuthStatebecomesFAILEDand noauthTokenis issued — so the user has no session. Confirming why the sign-in is rejected for a brand-new invited account needs backend logs and is outsideExpensify/App.2. Why it's a silent dead-end on Android specifically (App-side, and the part we can fix). On the failure above, the native
ValidateLoginPagehandlesautoAuthState === FAILEDby just callingNavigation.goBack()with no UI at all:App/src/pages/ValidateLoginPage/index.tsx
Lines 42 to 50 in ba92a8a
The web version renders an
ExpiredValidateCodeModalon the exact sameFAILEDstate, so web surfaces an actionable error while native shows nothing:App/src/pages/ValidateLoginPage/index.web.tsx
Line 168 in ba92a8a
That gap is exactly the reported behavior on Android: dropped into the app, no session, no message.
Note: I checked the theory that native drops the
?exitTo=query param (which would explain a missing redirect). It does not — running the app's React NavigationgetStateFromPath(v7.16.1) onv/123/abc?exitTo=/r/456returnsexitTo: "/r/456"as a route param, soexitTois preserved on native. The missing redirect is a consequence of the failed sign-in (noauthToken→handleExitToNavigation'swaitForUserSignIn()never resolves), not of param parsing.What changes do you think we should make in order to solve the problem?
The App-side fix is to bring native to parity with web: instead of silently
goBack()-ing onFAILED, render the failure state so the user gets feedback rather than a dead-end.In
src/pages/ValidateLoginPage/index.tsx, drop the silentgoBack()effect onFAILEDand renderExpiredValidateCodeModalfor that state (the loader otherwise):ExpiredValidateCodeModalis built from cross-platform primitives (View/Text/Icon/TextLink), so it renders on native as-is. For a brand-new invited user there's no cachedcredentials.login, so it shows the plain "your magic code has expired" copy (no "request one here" link), which is the correct message for an expired/invalid link.This turns the Android silent dead-end into the same actionable error web already shows. The underlying "the link should have logged me in" behavior still needs the server-side investigation in root-cause layer 1 above, which should be escalated to an internal engineer in parallel.
What alternative solutions did you explore? (Optional)
goBack()keeps a real App-side UX bug (no feedback on a failed link) that is worth fixing regardless of the backend outcome, and gives affected users a next step.ValidateLoginPagefiles have diverged significantly (web carries 2FA / direct-sign-in handling native doesn't). A minimal, native-only render change is lower-risk than a shared refactor; the refactor can be a separate cleanup.abbasifaizan70 commentedon Aug 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
A brand-new external user is invited by email to a room they have no Expensify account for. They open the "Reply to this message or respond at new.expensify.com" magic link from their email inbox on Android. Instead of being automatically signed in and dropped into the room they were invited to, the app opens in a signed-out state — the magic sign-in never happens and the invite destination is lost.
What is the root cause of that problem?
The magic link is a
ROUTES.VALIDATE_LOGINURL (/v/:accountID/:validateCode?exitTo=...). That route is registered as a "public screen" route:App/src/ROUTES.ts
Lines 56 to 65 in 650d353
isPublicScreenRoute()matches any of those patterns against the parsed route:https://github.com/Expensify/App/blob/650d35388a55fce99038f1fa8c89493252d64370/src/libs/isPublicScreenRoute.ts
The only code that can actually make
ValidateLoginPagemount (and run the effect that callssignInWithValidateCodeAndNavigate) is React Navigation's own cold-start deep-link resolution, becauseopenReportFromDeepLink()explicitly refuses to navigate to public-screen routes itself when the user isn't authenticated yet — it assumes React Navigation's linking layer already showed that screen:App/src/libs/actions/Link.ts
Lines 499 to 502 in 650d353
ValidateLoginPageonly runs its sign-in effect once it is actually mounted withaccountID/validateCode/exitToroute params:App/src/pages/ValidateLoginPage/index.tsx
Lines 16 to 40 in 650d353
For React Navigation to mount that screen on a cold start, it has to resolve the initial deep-link URL itself. But the app's
linkingConfignever supplies agetInitialURL, so React Navigation falls back to its own internal (unguarded, no generous timeout) call toLinking.getInitialURL():App/src/libs/Navigation/linkingConfig/index.ts
Lines 11 to 17 in 650d353
Meanwhile, the app already has one reliable path to that same URL:
DeepLinkHandlerracesLinking.getInitialURL()against a generous, purpose-built 10s timeout and carefully guards against re-entrancy/stale closures before consuming the result:App/src/DeepLinkHandler.tsx
Lines 58 to 98 in 650d353
App/src/CONST/index.ts
Line 2148 in 650d353
For a
/v/...link,getReportIDFromLink()returns falsy (it only matches/r/:reportID), soopenReportFromDeepLink()immediately callsdoneCheckingPublicRoom()and, per the early return above, does nothing further with the URL — it never hands the already-resolved value to React Navigation:App/src/libs/actions/Link.ts
Lines 481 to 502 in 650d353
So the same native "initial URL" is queried twice, independently: once (reliably) by
DeepLinkHandler, and once (again, separately) inside React Navigation's own linking machinery — with no sharing of the value that was already fetched. On Android, this second query goes through the app's ownLinking.getInitialURL()override, which on the native "App" build (HybridApp) is backed by the OldDot bridge that the codebase itself documents as unreliable:App/src/setup/hybridApp/index.native.ts
Lines 6 to 10 in 650d353
App/src/Expensify.tsx
Lines 304 to 307 in 650d353
That comment ("In HybridApp,
getInitialURL()may never resolve (OldDot native bridge)") is exactly why the app built its own patient, guarded acquisition path inDeepLinkHandler. But that protection only benefits report links handled insideopenReportFromDeepLink; for public-screen routes like the magic sign-in link, React Navigation's unrelated, unprotected second query is the only thing deciding whetherValidateLoginPageever mounts. When that second query is slow or comes back empty, the magic link is silently dropped and the app boots to its default signed-out screen — matching "user is directed to app without logged in," and losing theexitTodestination (the invited room) entirely.What changes do you think we should make in order to solve the problem?
Instead of letting React Navigation re-query the native bridge a second time for the same value, feed it the URL that
DeepLinkHandleralready resolved reliably.NavigationRootalready receives that value as itsinitialUrlprop:App/src/libs/Navigation/NavigationRoot.tsx
Lines 126 to 153 in 650d353
and currently passes the static
linkingConfigstraight through toNavigationContainer:App/src/libs/Navigation/NavigationRoot.tsx
Lines 311 to 318 in 650d353
Override
getInitialURLon thelinkingobject passed toNavigationContainerso it resolves to the already-knowninitialUrlinstead of triggering React Navigation's own independent native call:and pass
linking={linking}instead oflinking={linkingConfig}onNavigationContainer(line 318).This is minimal and reuses what already exists:
linkingConfig'sprefixes/getStateFromPath/config/subscribeare untouched, and no new deep-link-fetching code is introduced — we simply stop asking the (documented-as-unreliable-on-HybridApp) native bridge a second time for information the app already has.Edge cases:
initialUrlisnull, sogetInitialURLresolves toundefined/null, which is exactly what React Navigation's own default would produce for "no deep link" — no behavior change./r/...): unaffected.openReportFromDeepLink()still owns navigation for these viawaitForUserSignIn()/Navigation.navigate(), and this change only makes React Navigation's own initial-state resolution consistent with the URL that was already fetched, rather than introducing a second, divergent read.CONFIG.IS_HYBRID_APPis false there, soLinking.getInitialURL()is the fast, standard implementation and already resolves beforeDeepLinkHandlerfinishes; reusing that resolved value removes a redundant call with no functional change.linkingConfig: it remains untouched at its export; the override is applied only at the single call site inNavigationRoot.tsx, so no other consumer is affected.melvin-bot commentedon Aug 22, 2026
Unable to auto-create job on Upwork. The BZ team member should create it manually for this issue.
ahmdshrif commentedon Aug 22, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
A brand-new user invited to a workspace #room taps the magic link in the invite email on Android and is dropped into the app signed out on the sign-in page, instead of being signed in and taken to the room.
What is the root cause of that problem?
The invite link is a validate-login deep link (
/v/<accountID>/<validateCode>?exitTo=r/<reportID>), which Android routes to the publicValidateLoginPage. Native and web have separate implementations, and the native one is missing theautoAuthStateinitialization web does:App/src/pages/ValidateLoginPage/index.tsx
Lines 24 to 50 in f2e9721
On mount it starts
signInWithValidateCodeAndNavigate(), and a second effect — which also runs on that same first render — callsNavigation.goBack()the moment it seessession.autoAuthState === FAILED.autoAuthStateis persisted in theSESSIONOnyx key, so aFAILEDleft over from an earlier link attempt is still present at mount: the guard fires against the stale value before the freshly-issuedSignInUserWithLinkhas returned. The page unmounts,goBack()lands on the sign-in screen, and the pendingexitTonavigation registered byhandleExitToNavigation()is discarded — the observed symptom. Web avoids this by explicitly neutralising the persisted value and ignoring it on the first render, for exactly this reason:App/src/pages/ValidateLoginPage/index.web.tsx
Lines 43 to 48 in f2e9721
I can point at the stale-
FAILEDread in code; I have not confirmed from the video whether the backend call also failed. Either way the native page can't distinguish "this link failed" from "a previous link failed", and surfaces no error in either case.What changes do you think we should make in order to solve the problem?
In
src/pages/ValidateLoginPage/index.tsx, mirror web: callinitAutoAuthState()on mount so the persisted value is reset before sign-in starts, and only honourFAILEDonce this mount has initialized it.Regression risk stays inside the native validate-login path: a genuinely expired link still resolves to
FAILEDafter the API responds and still falls back togoBack()— the only change is that an earlier attempt's result can no longer abort the current one.35 remaining items
mallenexpensify commentedon Sep 10, 2026
Payment Summary
Contributor: @samarroy84 paid $250 via Upwork
Contributor+: @mkhutornyi due $250 via NewDot
melvin-bot commentedon Sep 18, 2026
@mallenexpensify Uh oh! This issue is overdue by 2 days. Don't forget to update your issues!
mallenexpensify commentedon Sep 19, 2026
@samarroy84 can you please accept the job below? Please reply here and tag me once you have.
https://www.upwork.com/jobs/~022101102785517701418
The job that I previously linked above is 👻
samarroy84 commentedon Sep 19, 2026
@mallenexpensify I already accepted offer. Can you please check again?
Offer id: 112502607
mallenexpensify commentedon Sep 21, 2026
Found it and paid @samarroy84 , closing other. Sorry for hassle
trjExpensify commentedon Oct 1, 2026
approved $250 for @mkhutornyi