diff --git a/src/components/DeeplinkWrapper/index.website.tsx b/src/components/DeeplinkWrapper/index.website.tsx index b395eb12c5fe..6f6562f97c17 100644 --- a/src/components/DeeplinkWrapper/index.website.tsx +++ b/src/components/DeeplinkWrapper/index.website.tsx @@ -22,6 +22,11 @@ function promptToOpenInDesktopApp(initialUrl = '') { // 2. There may be non-idempotent operations (e.g. create a new workspace), which obviously should not be executed again in the desktop app. // So we need to wait until after sign-in and navigation are complete before starting the deeplink redirect. if (Str.startsWith(window.location.pathname, Str.normalizeUrl(ROUTES.TRANSITION_BETWEEN_APPS))) { + const params = new URLSearchParams(window.location.search); + // If the user is redirected from the desktop app, don't prompt the user to open in desktop. + if (params.get('referrer') === 'desktop') { + return; + } App.beginDeepLinkRedirectAfterTransition(); } else { // Match any magic link (/v//<6 digit code>) diff --git a/src/libs/actions/Link.ts b/src/libs/actions/Link.ts index 886f8b06fc6f..13fcea0df85d 100644 --- a/src/libs/actions/Link.ts +++ b/src/libs/actions/Link.ts @@ -195,7 +195,8 @@ function buildURLWithAuthToken(url: string, shortLivedAuthToken?: string) { const emailParam = `email=${encodeURIComponent(currentUserEmail)}`; const exitTo = `exitTo=${url}`; const accountID = `accountID=${currentUserAccountID}`; - const paramsArray = [accountID, emailParam, authTokenParam, exitTo]; + const referrer = 'referrer=desktop'; + const paramsArray = [accountID, emailParam, authTokenParam, exitTo, referrer]; const params = paramsArray.filter(Boolean).join('&'); return `${CONFIG.EXPENSIFY.NEW_EXPENSIFY_URL}transition?${params}`;