Skip to content

Commit

Permalink
Adrienne / Fix issue where user is still not logged in after oidc soc…
Browse files Browse the repository at this point in the history
…ial login (#17989)

* chore: fix issue where user is still not logged in after oidc social signup

* chore: fix issue where user is still not logged in after oidc social signup
  • Loading branch information
adrienne-deriv authored Jan 16, 2025
1 parent 5060a77 commit f4acd1e
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/hooks/src/useSilentLoginAndLogout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,20 @@ const useSilentLoginAndLogout = ({
useEffect(() => {
// NOTE: Remove this logic once social signup is intergated with OIDC
const params = new URLSearchParams(window.location.search);
const isUsingLegacyFlow = params.has('token1');
if (isUsingLegacyFlow) return;
const isUsingLegacyFlow = params.has('token1') && params.has('acct1');
if (isUsingLegacyFlow && loggedState === 'false' && isOAuth2Enabled) {
const currentDomain = window.location.hostname.split('.').slice(-2).join('.');
Cookies.set('logged_state', 'true', {
expires: 30,
path: '/',
domain: currentDomain,
secure: true,
});
return;
}

if (
!isUsingLegacyFlow &&
loggedState === 'true' &&
!isClientAccountsPopulated &&
isOAuth2Enabled &&
Expand All @@ -48,6 +58,7 @@ const useSilentLoginAndLogout = ({
}

if (
!isUsingLegacyFlow &&
loggedState === 'false' &&
is_client_store_initialized &&
isOAuth2Enabled &&
Expand Down

0 comments on commit f4acd1e

Please sign in to comment.