diff --git a/packages/core/src/App/AppContent.tsx b/packages/core/src/App/AppContent.tsx index 2b3b46ee4979..5adad1c6bb32 100644 --- a/packages/core/src/App/AppContent.tsx +++ b/packages/core/src/App/AppContent.tsx @@ -66,6 +66,7 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough } const { isChangingToHubAppId } = useIsHubRedirectionEnabled(); const is_app_id_set = localStorage.getItem('config.app_id'); + const is_change_login_app_id_set = localStorage.getItem('change_login_app_id'); const [isWebPasskeysFFEnabled, isGBLoaded] = useGrowthbookIsOn({ featureFlag: 'web_passkeys', @@ -115,9 +116,11 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough } React.useEffect(() => { if (isChangingToHubAppId && !is_app_id_set) { const app_id = process.env.NODE_ENV === 'production' ? 61554 : 53503; - localStorage.setItem('config.app_id', app_id.toString()); + localStorage.setItem('change_login_app_id', app_id.toString()); + return; } - }, [isChangingToHubAppId, is_app_id_set]); + is_change_login_app_id_set && localStorage.removeItem('change_login_app_id'); + }, [isChangingToHubAppId, is_app_id_set, is_change_login_app_id_set]); React.useEffect(() => { switchLanguage(current_language); diff --git a/packages/shared/src/utils/login/login.ts b/packages/shared/src/utils/login/login.ts index a66f1341ed88..76f3392b821d 100644 --- a/packages/shared/src/utils/login/login.ts +++ b/packages/shared/src/utils/login/login.ts @@ -26,6 +26,7 @@ type TLoginUrl = { export const loginUrl = ({ language }: TLoginUrl) => { const server_url = LocalStore.get('config.server_url'); + const change_login_app_id = LocalStore.get('change_login_app_id'); // eslint-disable-next-line @typescript-eslint/no-explicit-any const signup_device_cookie = new (CookieStorage as any)('signup_device'); const signup_device = signup_device_cookie.get('signup_device'); @@ -38,7 +39,7 @@ export const loginUrl = ({ language }: TLoginUrl) => { const getOAuthUrl = () => { return `https://oauth.${ deriv_urls.DERIV_HOST_NAME - }/oauth2/authorize?app_id=${getAppId()}&l=${language}${marketing_queries}&brand=${website_name.toLowerCase()}`; + }/oauth2/authorize?app_id=${change_login_app_id || getAppId()}&l=${language}${marketing_queries}&brand=${website_name.toLowerCase()}`; }; if (server_url && /qa/.test(server_url)) {