Skip to content

Commit f4acd1e

Browse files
Adrienne / Fix issue where user is still not logged in after oidc social 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
1 parent 5060a77 commit f4acd1e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

packages/hooks/src/useSilentLoginAndLogout.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,20 @@ const useSilentLoginAndLogout = ({
3131
useEffect(() => {
3232
// NOTE: Remove this logic once social signup is intergated with OIDC
3333
const params = new URLSearchParams(window.location.search);
34-
const isUsingLegacyFlow = params.has('token1');
35-
if (isUsingLegacyFlow) return;
34+
const isUsingLegacyFlow = params.has('token1') && params.has('acct1');
35+
if (isUsingLegacyFlow && loggedState === 'false' && isOAuth2Enabled) {
36+
const currentDomain = window.location.hostname.split('.').slice(-2).join('.');
37+
Cookies.set('logged_state', 'true', {
38+
expires: 30,
39+
path: '/',
40+
domain: currentDomain,
41+
secure: true,
42+
});
43+
return;
44+
}
3645

3746
if (
47+
!isUsingLegacyFlow &&
3848
loggedState === 'true' &&
3949
!isClientAccountsPopulated &&
4050
isOAuth2Enabled &&
@@ -48,6 +58,7 @@ const useSilentLoginAndLogout = ({
4858
}
4959

5060
if (
61+
!isUsingLegacyFlow &&
5162
loggedState === 'false' &&
5263
is_client_store_initialized &&
5364
isOAuth2Enabled &&

0 commit comments

Comments
 (0)