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
Gusto - Unable to connect - Error: "We've locked your account" #94927
Enter email and password: Use Gusto Demo app credentials from 1Password
Tap Continue
Expected Result:
Able to connect with Gusto. the panel title reads "Successfully synced your Gusto connection!"
Actual Result:
Error: "We've locked your account
To keep your information safe, we've temporarily locked your account.
Check your email (and maybe your spam folder) for instructions on how to sign in.
Send"
Root Cause: This is a backend/internal issue, not an App bug. The "We've locked your account" screen is Expensify's standard account-lockout page — it is served by the backend, not rendered by the App. (The string does not exist anywhere in Expensify/App; the only nearby match is the unrelated cardLocked copy in en.ts.)
The App's only role in the Gusto HR connection is to build a backend command URL and hand the user off to it: getGustoSetupLink calls READ_COMMANDS.CONNECT_POLICY_TO_GUSTO with shouldSkipWebProxy: true. From that point the Gusto credential entry and OAuth/sync are handled by the backend. The account lockout is being triggered server-side during that flow.
Recommended Fix: Requires investigation outside the App repo (Web-Expensify / Auth — the CONNECT_POLICY_TO_GUSTO handler and the account-lock mechanism). This should be escalated to an internal engineer with access to those repos. There is no App-side code change that would resolve this. A likely line of investigation: the Gusto setup flow re-validating the Expensify session is tripping the account-lock guard for applausetester+gusto@applause.expensifail.com (the account may currently be locked — note the test instructions reuse Gusto demo credentials, which can cause repeated failed auth attempts).
Investigation details
Symptom: During HR → Connect Gusto, after entering Gusto demo credentials, the user sees "We've locked your account / To keep your information safe, we've temporarily locked your account. Check your email… Send". Reproducible in staging and production; iOS & Android.
Evidence the message is backend-served:grep -rin "locked your account|keep your information safe|temporarily locked your" over App/src returns no matches. The "Send" button (resend magic-link/sign-in instructions) is the Expensify account-lockout page, not Gusto's UI.
App hand-off point:src/libs/actions/connections/Gusto.ts:12-18 — the App just returns the command URL and navigates there; it does not handle credentials or the lock response.
Alternative explanations considered: (1) An App-side error map surfacing this copy — ruled out, the string isn't in the repo. (2) Gusto's own lockout — ruled out by the Expensify-specific "Send instructions to your email" wording. The remaining explanation is the Expensify account-lock guard firing server-side during the connect flow.
Confidence: Medium-high that the root cause is backend. Exact trigger needs server logs / Auth code review, which require internal access.
Next Steps for Contributor+ team:
This is not actionable in Expensify/App. Please escalate to an internal engineer to investigate the CONNECT_POLICY_TO_GUSTO handler and the account-lock behavior in Web-Expensify/Auth, and to confirm whether the applausetester+gusto account is currently locked. To refine:@MelvinBot <your feedback>
🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 03:50:04 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the tester connects Gusto from HR settings on iOS or Android, the connect screen shows "We've locked your account / To keep your information safe, we've temporarily locked your account. Check your email… Send" instead of completing the sync. The account ends up locked rather than connected.
What is the root cause of that problem?
That screen is not rendered by the App. It's Expensify's own account-lockout page (the giveaway is the "Check your email… Send" resend-instructions button), served by the backend inside the connect session. Grepping src/ for "locked your account", "keep your information safe", and "temporarily locked" returns nothing, so no App copy or error map produces it.
The App's only job in this flow is to build a backend command URL and hand the user off to it. getGustoSetupLink (src/libs/actions/connections/Gusto.ts:18) builds commandURL + new URLSearchParams({policyID}).toString(). getCommandURL (src/libs/ApiUtils.ts:61) appends a single clean ? only when one isn't already there, and URLSearchParams produces policyID=123, so the URL is well-formed. On native, getShortLivedAuthTokenURL (src/libs/actions/Link.ts:425-438) fetches a short-lived token and appends it, then the link loads in the WebView (Android) / ASWebAuthenticationSession (iOS). From there the credential entry, OAuth, and sync are all backend (CONNECT_POLICY_TO_GUSTO).
A couple of details rule out the App as the cause. The same builder and hand-off serve Zenefits and Merge HR, and those connect fine. The connect call fires exactly once, guarded by hasFetched.current in ConnectToHRFlow/index.native.tsx and hasOpened.current in index.ios.tsx, so there's no retry storm hammering the endpoint. What's left is the server-side lock firing for applausetester+gusto@applause.expensifail.com. The test steps reuse shared Gusto demo credentials across regression runs, which is exactly the kind of repeated-auth pattern that trips Expensify's anti-fraud account lock. The account is almost certainly already locked.
What changes do you think we should make in order to solve the problem?
There's no App-side code change that fixes this, because the App isn't where the lock is decided. This needs to go to an internal engineer with access to Web-Expensify / Auth: confirm whether applausetester+gusto is currently locked (and unlock it for testing), and review the account-lock guard against the CONNECT_POLICY_TO_GUSTO hand-off. If the goal is also to handle a locked account more gracefully in the connect WebView, that's still a backend decision about what gets rendered in that session.
What alternative solutions did you explore? (Optional)
I looked hard at the URL building, since that's the one piece the App controls. One theory is that the native hand-off omits the email param that buildOldDotURL (Link.ts:60-63) attaches, leaving the token unbound. But the hand-off authenticates with the short-lived authToken, which the backend resolves to the account on its own, the URL itself is well-formed, and the identical native path works for the other HR providers. The page being shown is the "your account is locked, resend instructions" page, not a sign-in-failed page, which points to a lock that already exists rather than a bad request. I also checked whether an App error map could surface this copy. It can't, the strings aren't in the repo.
changed the title [-]Gusto - Unable to connect - Error: "We've locked your account"[/-][+][$250] Gusto - Unable to connect - Error: "We've locked your account"[/+]on Jun 30, 2026
The Gusto connect flow opens an OldDot authenticated URL. The setup link is built by getGustoSetupLink, which targets the OldDot ConnectPolicyToGusto command with shouldSkipWebProxy: true, i.e. a bare https://www.expensify.com/api/ConnectPolicyToGusto?policyID=… URL with no credentials attached:
On native that link is authenticated by getShortLivedAuthTokenURL, which fetches a short-lived token via OPEN_OLD_DOT_LINK and appends onlyauthToken to the URL:
Log.warn('[Link] Failed to fetch short-lived auth token',{error});
returnsetupLink;
});
}
That URL is then loaded inside the in-app WebView (Android) and the ephemeral ASWebAuthenticationSession (iOS) — both of which start with no Expensify session cookies, so the URL params are the only identity OldDot receives:
The problem is that OldDot authenticates a link with authTokenplus the email (the partnerUserID the token is bound to). Every other OldDot deep link in the app is built through buildOldDotURL, which always appends bothauthTokenandemail:
The web path proves this: ConnectToHRFlow (web) routes the same setup link through openLink → openOldDotLink → buildOldDotURL, so on web the OldDot URL carries email and the connection authenticates correctly (web is not in the affected platforms list):
So: native loads the OldDot URL with authToken but no email, so OldDot can't bind the short-lived token to the account and treats each cookie-less WebView load as a failed sign-in; the repeated failed attempts trip OldDot's security lock and the WebView renders the "We've locked your account" page → the symptom. The omission is identical on both native platforms, which is exactly why iOS App and Android App are affected while web/mWeb are not.
What changes do you think we should make in order to solve the problem?
Make the native auth URL carry the same credentials as every other OldDot link by appending the email param alongside authToken, reusing the exact pattern already in buildOldDotURL (Link.ts#L60-L63). currentUserEmail is already maintained in scope in this same file via the session Onyx connection (Link.ts#L41-L47), so no new wiring is needed — only Url.appendParam, already used here.
This mirrors buildOldDotURL exactly (both authToken and email, and email is attached even on the token-failure/fallback paths), so the native Gusto/Merge HR WebViews authenticate against OldDot the same way the web flow already does. The fix is a single function with zero new call sites; it automatically covers both native consumers (index.native.tsx and index.ios.tsx) and every HR provider (Gusto, Zenefits, Merge) that shares this flow. Minor changes/improvements can be discussed in the PR phase.
What alternative solutions did you explore? (Optional)
Route the native flow through openOldDotLink/buildOldDotURL directly instead of getShortLivedAuthTokenURL. That would also include the email, but buildOldDotURL re-prepends the OldDot domain and reshapes the query string, whereas the native setup link is already a full absolute URL — reusing it would risk a malformed URL and changes more behavior. Appending email in getShortLivedAuthTokenURL is the smaller, lower-risk change that fixes the root cause where it actually occurs.
Please re-state the problem that we are trying to solve in this issue.
When connecting a workspace to Gusto (Workspace → HR → Connect Gusto), after entering the Gusto credentials and tapping Continue, instead of completing the connection the user is shown the OldDot account-lock screen: "We've locked your account… Check your email (and maybe your spam folder) for instructions on how to sign in." This is reproducible on iOS App and Android App in both staging and production.
What is the root cause of that problem?
The HR connect flow builds a setup link that points to an OldDot API command (ConnectPolicyToGusto) with shouldSkipWebProxy: true, carrying only policyID. This URL is then opened inside an isolated web session (an ephemeral ASWebAuthenticationSession on iOS, an incognito/cookie-cleared WebView on Android), so the web session starts with no Expensify cookies — the URL itself is the only thing that can authenticate the request.
On iOS the flow fetches a short-lived auth token and opens the resulting URL with preferEphemeralSession: true, meaning the session does not share any cookies with Safari and must rely entirely on the credentials in the URL.
Log.warn('[Link] Failed to fetch short-lived auth token',{error});
returnsetupLink;
});
}
Compare this with the canonical OldDot deep-link builder buildOldDotURL, which always appends bothauthTokenandemail (the account the short-lived token belongs to). OldDot validates a short-lived token against the email/partnerUserID supplied alongside it:
Because getShortLivedAuthTokenURL omits the email parameter, OldDot receives a short-lived token with no associated account to validate it against. In a cookie-less web session this authentication cannot succeed, so the request is treated as an unauthenticated/failed sign-in attempt and OldDot serves the temporary account-lock screen instead of the Gusto OAuth page.
What changes do you think we should make in order to solve the problem?
Make getShortLivedAuthTokenURL mirror buildOldDotURL by appending the current user's email next to authToken, so OldDot can validate the short-lived token in the cookie-less web session. currentUserEmail is already maintained from the session in this module.
This applies to all HR providers that route through getShortLivedAuthTokenURL (Gusto, Zenefits, Merge HR), since they all build the same kind of shouldSkipWebProxy command URL and open it in an isolated web session.
changed the title [-][$250] Gusto - Unable to connect - Error: "We've locked your account"[/-][+]Gusto - Unable to connect - Error: "We've locked your account"[/+]on Jul 10, 2026
Activity
applause-bot commentedon Jun 30, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/e6d3ed2c122d22e198f7bfb19bf9f2d59a18f675b09bb1bca3b578c2ca1c9ee6
https://platform.applause.com/services/links/v1/external/84e4e4ccad44df009b51f433a47c5de81e00e35cd36329dc19acbf3b9bb478a4
MelvinBot commentedon Jun 30, 2026
Issue Analysis
Root Cause: This is a backend/internal issue, not an App bug. The "We've locked your account" screen is Expensify's standard account-lockout page — it is served by the backend, not rendered by the App. (The string does not exist anywhere in
Expensify/App; the only nearby match is the unrelatedcardLockedcopy inen.ts.)The App's only role in the Gusto HR connection is to build a backend command URL and hand the user off to it:
getGustoSetupLinkcallsREAD_COMMANDS.CONNECT_POLICY_TO_GUSTOwithshouldSkipWebProxy: true. From that point the Gusto credential entry and OAuth/sync are handled by the backend. The account lockout is being triggered server-side during that flow.Recommended Fix: Requires investigation outside the App repo (Web-Expensify / Auth — the
CONNECT_POLICY_TO_GUSTOhandler and the account-lock mechanism). This should be escalated to an internal engineer with access to those repos. There is no App-side code change that would resolve this. A likely line of investigation: the Gusto setup flow re-validating the Expensify session is tripping the account-lock guard forapplausetester+gusto@applause.expensifail.com(the account may currently be locked — note the test instructions reuse Gusto demo credentials, which can cause repeated failed auth attempts).Investigation details
grep -rin "locked your account|keep your information safe|temporarily locked your"overApp/srcreturns no matches. The "Send" button (resend magic-link/sign-in instructions) is the Expensify account-lockout page, not Gusto's UI.src/libs/actions/connections/Gusto.ts:12-18— the App just returns the command URL and navigates there; it does not handle credentials or the lock response.Next Steps for Contributor+ team:
This is not actionable in
Expensify/App. Please escalate to an internal engineer to investigate theCONNECT_POLICY_TO_GUSTOhandler and the account-lock behavior in Web-Expensify/Auth, and to confirm whether theapplausetester+gustoaccount is currently locked.To refine:
@MelvinBot <your feedback>neerajbachani commentedon Jun 30, 2026
proposal
melvin-bot commentedon Jun 30, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Eskalifer1 (
External)shivang-goliyan commentedon Jun 30, 2026
🚨 Edited by proposal-police: This proposal was edited at 2026-06-30 03:50:04 UTC.
Proposal
Please re-state the problem that we are trying to solve in this issue.
When the tester connects Gusto from HR settings on iOS or Android, the connect screen shows "We've locked your account / To keep your information safe, we've temporarily locked your account. Check your email… Send" instead of completing the sync. The account ends up locked rather than connected.
What is the root cause of that problem?
That screen is not rendered by the App. It's Expensify's own account-lockout page (the giveaway is the "Check your email… Send" resend-instructions button), served by the backend inside the connect session. Grepping
src/for "locked your account", "keep your information safe", and "temporarily locked" returns nothing, so no App copy or error map produces it.The App's only job in this flow is to build a backend command URL and hand the user off to it.
getGustoSetupLink(src/libs/actions/connections/Gusto.ts:18) buildscommandURL + new URLSearchParams({policyID}).toString().getCommandURL(src/libs/ApiUtils.ts:61) appends a single clean?only when one isn't already there, andURLSearchParamsproducespolicyID=123, so the URL is well-formed. On native,getShortLivedAuthTokenURL(src/libs/actions/Link.ts:425-438) fetches a short-lived token and appends it, then the link loads in the WebView (Android) /ASWebAuthenticationSession(iOS). From there the credential entry, OAuth, and sync are all backend (CONNECT_POLICY_TO_GUSTO).A couple of details rule out the App as the cause. The same builder and hand-off serve Zenefits and Merge HR, and those connect fine. The connect call fires exactly once, guarded by
hasFetched.currentinConnectToHRFlow/index.native.tsxandhasOpened.currentinindex.ios.tsx, so there's no retry storm hammering the endpoint. What's left is the server-side lock firing forapplausetester+gusto@applause.expensifail.com. The test steps reuse shared Gusto demo credentials across regression runs, which is exactly the kind of repeated-auth pattern that trips Expensify's anti-fraud account lock. The account is almost certainly already locked.What changes do you think we should make in order to solve the problem?
There's no App-side code change that fixes this, because the App isn't where the lock is decided. This needs to go to an internal engineer with access to Web-Expensify / Auth: confirm whether
applausetester+gustois currently locked (and unlock it for testing), and review the account-lock guard against theCONNECT_POLICY_TO_GUSTOhand-off. If the goal is also to handle a locked account more gracefully in the connect WebView, that's still a backend decision about what gets rendered in that session.What alternative solutions did you explore? (Optional)
I looked hard at the URL building, since that's the one piece the App controls. One theory is that the native hand-off omits the
emailparam thatbuildOldDotURL(Link.ts:60-63) attaches, leaving the token unbound. But the hand-off authenticates with the short-livedauthToken, which the backend resolves to the account on its own, the URL itself is well-formed, and the identical native path works for the other HR providers. The page being shown is the "your account is locked, resend instructions" page, not a sign-in-failed page, which points to a lock that already exists rather than a bad request. I also checked whether an App error map could surface this copy. It can't, the strings aren't in the repo.[-]Gusto - Unable to connect - Error: "We've locked your account"[/-][+][$250] Gusto - Unable to connect - Error: "We've locked your account"[/+]melvin-bot commentedon Jun 30, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022071802269479280056
yusufdeveloper2903 commentedon Jun 30, 2026
Proposal
What is the root cause of that problem?
The Gusto connect flow opens an OldDot authenticated URL. The setup link is built by
getGustoSetupLink, which targets the OldDotConnectPolicyToGustocommand withshouldSkipWebProxy: true, i.e. a barehttps://www.expensify.com/api/ConnectPolicyToGusto?policyID=…URL with no credentials attached:App/src/libs/actions/connections/Gusto.ts
Lines 12 to 19 in 05d32d5
On native that link is authenticated by
getShortLivedAuthTokenURL, which fetches a short-lived token viaOPEN_OLD_DOT_LINKand appends onlyauthTokento the URL:App/src/libs/actions/Link.ts
Lines 425 to 438 in 05d32d5
That URL is then loaded inside the in-app WebView (Android) and the ephemeral
ASWebAuthenticationSession(iOS) — both of which start with no Expensify session cookies, so the URL params are the only identity OldDot receives:App/src/components/ConnectToHRFlow/index.native.tsx
Lines 29 to 35 in 05d32d5
App/src/components/ConnectToHRFlow/index.ios.tsx
Lines 31 to 47 in 05d32d5
The problem is that OldDot authenticates a link with
authTokenplus theemail(thepartnerUserIDthe token is bound to). Every other OldDot deep link in the app is built throughbuildOldDotURL, which always appends bothauthTokenandemail:App/src/libs/actions/Link.ts
Lines 60 to 63 in 05d32d5
The web path proves this:
ConnectToHRFlow(web) routes the same setup link throughopenLink→openOldDotLink→buildOldDotURL, so on web the OldDot URL carriesemailand the connection authenticates correctly (web is not in the affected platforms list):App/src/components/ConnectToHRFlow/index.tsx
Lines 6 to 14 in 05d32d5
App/src/libs/actions/Link.ts
Lines 80 to 96 in 05d32d5
So: native loads the OldDot URL with
authTokenbut noemail, so OldDot can't bind the short-lived token to the account and treats each cookie-less WebView load as a failed sign-in; the repeated failed attempts trip OldDot's security lock and the WebView renders the "We've locked your account" page → the symptom. The omission is identical on both native platforms, which is exactly why iOS App and Android App are affected while web/mWeb are not.What changes do you think we should make in order to solve the problem?
Make the native auth URL carry the same credentials as every other OldDot link by appending the
emailparam alongsideauthToken, reusing the exact pattern already inbuildOldDotURL(Link.ts#L60-L63).currentUserEmailis already maintained in scope in this same file via the session Onyx connection (Link.ts#L41-L47), so no new wiring is needed — onlyUrl.appendParam, already used here.In
getShortLivedAuthTokenURL:This mirrors
buildOldDotURLexactly (bothauthTokenandemail, andemailis attached even on the token-failure/fallback paths), so the native Gusto/Merge HR WebViews authenticate against OldDot the same way the web flow already does. The fix is a single function with zero new call sites; it automatically covers both native consumers (index.native.tsxandindex.ios.tsx) and every HR provider (Gusto, Zenefits, Merge) that shares this flow. Minor changes/improvements can be discussed in the PR phase.What alternative solutions did you explore? (Optional)
Route the native flow through
openOldDotLink/buildOldDotURLdirectly instead ofgetShortLivedAuthTokenURL. That would also include theemail, butbuildOldDotURLre-prepends the OldDot domain and reshapes the query string, whereas the native setup link is already a full absolute URL — reusing it would risk a malformed URL and changes more behavior. AppendingemailingetShortLivedAuthTokenURLis the smaller, lower-risk change that fixes the root cause where it actually occurs.abbasifaizan70 commentedon Jun 30, 2026
Proposal
Please re-state the problem that we are trying to solve in this issue.
What is the root cause of that problem?
The HR connect flow builds a setup link that points to an OldDot API command (
ConnectPolicyToGusto) withshouldSkipWebProxy: true, carrying onlypolicyID. This URL is then opened inside an isolated web session (an ephemeralASWebAuthenticationSessionon iOS, an incognito/cookie-clearedWebViewon Android), so the web session starts with no Expensify cookies — the URL itself is the only thing that can authenticate the request.App/src/libs/actions/connections/Gusto.ts
Lines 12 to 19 in ab1dd05
On iOS the flow fetches a short-lived auth token and opens the resulting URL with
preferEphemeralSession: true, meaning the session does not share any cookies with Safari and must rely entirely on the credentials in the URL.App/src/components/ConnectToHRFlow/index.ios.tsx
Lines 31 to 47 in ab1dd05
The token is added by
getShortLivedAuthTokenURL, which appends onlyauthTokento the setup link:App/src/libs/actions/Link.ts
Lines 425 to 438 in ab1dd05
Compare this with the canonical OldDot deep-link builder
buildOldDotURL, which always appends bothauthTokenandemail(the account the short-lived token belongs to). OldDot validates a short-lived token against the email/partnerUserID supplied alongside it:App/src/libs/actions/Link.ts
Lines 49 to 71 in ab1dd05
Because
getShortLivedAuthTokenURLomits theemailparameter, OldDot receives a short-lived token with no associated account to validate it against. In a cookie-less web session this authentication cannot succeed, so the request is treated as an unauthenticated/failed sign-in attempt and OldDot serves the temporary account-lock screen instead of the Gusto OAuth page.What changes do you think we should make in order to solve the problem?
Make
getShortLivedAuthTokenURLmirrorbuildOldDotURLby appending the current user'semailnext toauthToken, so OldDot can validate the short-lived token in the cookie-less web session.currentUserEmailis already maintained from the session in this module.App/src/libs/actions/Link.ts
Lines 425 to 438 in ab1dd05
This applies to all HR providers that route through
getShortLivedAuthTokenURL(Gusto, Zenefits, Merge HR), since they all build the same kind ofshouldSkipWebProxycommand URL and open it in an isolated web session.12 remaining items
melvin-bot commentedon Jul 6, 2026
Triggered auto assignment to @youssef-lr, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
melvin-bot commentedon Jul 7, 2026
📣 It's been a week! Do we have any satisfactory proposals yet? Do we need to adjust the bounty for this issue? 💸
melvin-bot commentedon Jul 9, 2026
@youssef-lr Whoops! This issue is 2 days overdue. Let's get this updated quick!
[-][$250] Gusto - Unable to connect - Error: "We've locked your account"[/-][+]Gusto - Unable to connect - Error: "We've locked your account"[/+]grgia commentedon Jul 10, 2026
We need to have QA regenerate credentials
IuliiaHerets commentedon Jul 10, 2026
Chrome / v9.4.32-3
Passed
bandicam.2026-07-10.15-11-07-858.mp4