Skip to content

Commit 2ac55e6

Browse files
authored
chore: append app id only happens at login not ws (deriv-com#17955)
1 parent 68d1aec commit 2ac55e6

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

packages/core/src/App/AppContent.tsx

+5-2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough }
6666
const { isChangingToHubAppId } = useIsHubRedirectionEnabled();
6767

6868
const is_app_id_set = localStorage.getItem('config.app_id');
69+
const is_change_login_app_id_set = localStorage.getItem('change_login_app_id');
6970

7071
const [isWebPasskeysFFEnabled, isGBLoaded] = useGrowthbookIsOn({
7172
featureFlag: 'web_passkeys',
@@ -115,9 +116,11 @@ const AppContent: React.FC<{ passthrough: unknown }> = observer(({ passthrough }
115116
React.useEffect(() => {
116117
if (isChangingToHubAppId && !is_app_id_set) {
117118
const app_id = process.env.NODE_ENV === 'production' ? 61554 : 53503;
118-
localStorage.setItem('config.app_id', app_id.toString());
119+
localStorage.setItem('change_login_app_id', app_id.toString());
120+
return;
119121
}
120-
}, [isChangingToHubAppId, is_app_id_set]);
122+
is_change_login_app_id_set && localStorage.removeItem('change_login_app_id');
123+
}, [isChangingToHubAppId, is_app_id_set, is_change_login_app_id_set]);
121124

122125
React.useEffect(() => {
123126
switchLanguage(current_language);

packages/shared/src/utils/login/login.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ type TLoginUrl = {
2626

2727
export const loginUrl = ({ language }: TLoginUrl) => {
2828
const server_url = LocalStore.get('config.server_url');
29+
const change_login_app_id = LocalStore.get('change_login_app_id');
2930
// eslint-disable-next-line @typescript-eslint/no-explicit-any
3031
const signup_device_cookie = new (CookieStorage as any)('signup_device');
3132
const signup_device = signup_device_cookie.get('signup_device');
@@ -38,7 +39,7 @@ export const loginUrl = ({ language }: TLoginUrl) => {
3839
const getOAuthUrl = () => {
3940
return `https://oauth.${
4041
deriv_urls.DERIV_HOST_NAME
41-
}/oauth2/authorize?app_id=${getAppId()}&l=${language}${marketing_queries}&brand=${website_name.toLowerCase()}`;
42+
}/oauth2/authorize?app_id=${change_login_app_id || getAppId()}&l=${language}${marketing_queries}&brand=${website_name.toLowerCase()}`;
4243
};
4344

4445
if (server_url && /qa/.test(server_url)) {

0 commit comments

Comments
 (0)