Skip to content

Commit

Permalink
Merge pull request #874 from hirad-deriv/Hirad/TRAH-4591/redirecting-…
Browse files Browse the repository at this point in the history
…outsystems-to-legacy-and-log-user-in

Hirad/TRAH-4591/ Accepting cookie from OutSystems and logging users in
  • Loading branch information
ahmadtaimoor-deriv authored Dec 20, 2024
2 parents c77e66f + 1ec5ad2 commit 58b4f4e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/javascript/app/pages/trade/tradepage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const Dropdown = require('@binary-com/binary-style').selectDropdown;
const Cookies = require('js-cookie');
const TradingAnalysis = require('./analysis');
const commonTrading = require('./common');
const cleanupChart = require('./charts/webtrader_chart').cleanupChart;
Expand Down Expand Up @@ -27,6 +28,21 @@ const TradePage = (() => {

const iframe_target_origin = getAllowedLocalStorageOrigin();
const isOauthEnabled = AuthClient.isOAuth2Enabled();
const client_accounts = Cookies.get('client.accounts');
const active_loginid = Cookies.get('active_loginid');

if (client_accounts && active_loginid) {
localStorage.setItem('client.accounts', client_accounts);
localStorage.setItem('active_loginid', active_loginid);

const domain = '.deriv.com';

// remove cookies after populating local storage
Cookies.remove('client.accounts', { domain, secure: true });
Cookies.remove('active_loginid', { domain, secure: true });

window.location.reload();
}
BinarySocket.wait('authorize').then(() => {
if (iframe_target_origin && !isOauthEnabled) {
const el_iframe = document.getElementById('localstorage-sync');
Expand Down

0 comments on commit 58b4f4e

Please sign in to comment.