Skip to content

Commit

Permalink
Adrienne / Read query params and store them for oidc (RC branch) (#17992
Browse files Browse the repository at this point in the history
)

* chore: read query params and store them for oidc

* chore: remove local storage setter for tokens
  • Loading branch information
adrienne-deriv authored Jan 16, 2025
1 parent 7df027f commit f9a118c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
15 changes: 15 additions & 0 deletions packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1529,6 +1529,21 @@ export default class ClientStore extends BaseStore {
if (search) {
if (window.location.pathname !== routes.callback_page) {
if (code_param && action_param) this.setVerificationCode(code_param, action_param);
// NOTE: Remove this logic once social signup is intergated with OIDC
const params = new URLSearchParams(window.location.search);
const isUsingLegacyFlow = params.has('token1') && params.has('acct1');
const loggedState = Cookies.get('logged_state');

if (isUsingLegacyFlow && loggedState === 'false') {
const currentDomain = window.location.hostname.split('.').slice(-2).join('.');
Cookies.set('logged_state', 'true', {
expires: 30,
path: '/',
domain: currentDomain,
secure: true,
});
}

document.addEventListener('DOMContentLoaded', () => {
setTimeout(() => {
// timeout is needed to get the token (code) from the URL before we hide it from the URL
Expand Down
7 changes: 0 additions & 7 deletions packages/hooks/src/useSilentLoginAndLogout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ const useSilentLoginAndLogout = ({
const params = new URLSearchParams(window.location.search);
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;
}

Expand Down

0 comments on commit f9a118c

Please sign in to comment.