Skip to content

Commit

Permalink
Adrienne / Set cookies to false to support social login (#17993)
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

* chore: set cookies logged_state to false once we are logged in using legacy

* chore: remove console log

* chore: remove old changes for oidc social logic
  • Loading branch information
adrienne-deriv authored Jan 17, 2025
1 parent cf5d152 commit 9ca82d7
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions packages/core/src/Stores/client-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -1545,20 +1545,6 @@ 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(() => {
Expand Down Expand Up @@ -2256,6 +2242,17 @@ export default class ClientStore extends BaseStore {
if (is_account_param) {
obj_params[key] = value;
is_social_signup_provider = true;
// NOTE: Remove this logic once social signup is intergated with OIDC
const loggedState = Cookies.get('logged_state');
if (loggedState === 'false') {
const currentDomain = window.location.hostname.split('.').slice(-2).join('.');
Cookies.set('logged_state', 'true', {
expires: 30,
path: '/',
domain: currentDomain,
secure: true,
});
}
}
});

Expand Down

0 comments on commit 9ca82d7

Please sign in to comment.