From bceca471b62993ec2412b79dbdbd828b88be9b01 Mon Sep 17 00:00:00 2001 From: kassad Date: Wed, 20 Nov 2024 07:23:03 -0800 Subject: [PATCH] Fixed custom domain magic login --- .../commonwealth/client/scripts/controllers/app/login.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/commonwealth/client/scripts/controllers/app/login.ts b/packages/commonwealth/client/scripts/controllers/app/login.ts index a729fb63ad8..167670a41e7 100644 --- a/packages/commonwealth/client/scripts/controllers/app/login.ts +++ b/packages/commonwealth/client/scripts/controllers/app/login.ts @@ -367,9 +367,15 @@ export async function startLoginWithMagicLink({ localStorage.setItem('magic_provider', provider!); localStorage.setItem('magic_chain', chain!); localStorage.setItem('magic_redirect_to', window.location.href); + + let redirectURI = new URL('/finishsociallogin', window.location.origin) + .href; + if (process.env.APP_ENV === 'production') { + redirectURI = 'https://commonwealth.im/finishsociallogin'; + } await magic.oauth2.loginWithRedirect({ provider, - redirectURI: new URL('/finishsociallogin', window.location.origin).href, + redirectURI, }); // magic should redirect away from this page, but we return after 5 sec if it hasn't