diff --git a/package-lock.json b/package-lock.json index b09b76abafd..28d38028566 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "@binary-com/binary-style": "^0.2.26", "@binary-com/webtrader-charts": "^0.6.2", "@deriv-com/analytics": "^1.26.1", - "@deriv-com/auth-client": "1.3.3", + "@deriv-com/auth-client": "1.3.8", "@deriv-com/quill-ui": "^1.16.2", "@deriv-com/utils": "^0.0.38", "@deriv/deriv-api": "^1.0.15", @@ -2527,9 +2527,9 @@ } }, "node_modules/@deriv-com/auth-client": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/@deriv-com/auth-client/-/auth-client-1.3.3.tgz", - "integrity": "sha512-LXp890lIZjZjSIs1OzHZCET/qQp9ACdLnbKOMXFAvqleNlUFZstlIhZIDYHTMorU3pclh3oG/wErZwRLNTMxkw==", + "version": "1.3.8", + "resolved": "https://registry.npmjs.org/@deriv-com/auth-client/-/auth-client-1.3.8.tgz", + "integrity": "sha512-5z6QT6dCvfykvExbPy1Xswe+dJjAZVPFLwKzlAZymFoYylqin8njvcgupM5RsnWvOCK2QLT5Vujq8e5F6njiMg==", "dependencies": { "@deriv-com/utils": "^0.0.42", "js-cookie": "3.0.5", diff --git a/package.json b/package.json index 027bdf7e43a..00f7fec8105 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,7 @@ "@binary-com/binary-style": "^0.2.26", "@binary-com/webtrader-charts": "^0.6.2", "@deriv-com/analytics": "^1.26.1", - "@deriv-com/auth-client": "1.3.3", + "@deriv-com/auth-client": "1.3.8", "@deriv-com/quill-ui": "^1.16.2", "@deriv-com/utils": "^0.0.38", "@deriv/deriv-api": "^1.0.15", diff --git a/src/javascript/_common/auth.js b/src/javascript/_common/auth.js index c70d0cb9cd2..fb08b32a33f 100644 --- a/src/javascript/_common/auth.js +++ b/src/javascript/_common/auth.js @@ -9,6 +9,7 @@ const Cookies = require('js-cookie'); const requestOidcAuthentication = require('@deriv-com/auth-client').requestOidcAuthentication; const OAuth2Logout = require('@deriv-com/auth-client').OAuth2Logout; const Analytics = require('./analytics'); +const Language = require('./language'); export const DEFAULT_OAUTH_LOGOUT_URL = 'https://oauth.deriv.com/oauth2/sessions/logout'; @@ -79,7 +80,13 @@ export const isOAuth2Enabled = () => { }; export const requestOauth2Logout = onWSLogoutAndRedirect => { - OAuth2Logout(onWSLogoutAndRedirect); + const currentLanguage = Language.get(); + + OAuth2Logout({ + WSLogoutAndRedirect : onWSLogoutAndRedirect, + redirectCallbackUri : `${window.location.origin}/${currentLanguage}/callback`, + postLogoutRedirectUri: `${window.location.origin}/${currentLanguage}/trading`, + }); }; export const requestSingleLogout = async (onWSLogoutAndRedirect) => { @@ -136,8 +143,9 @@ export const requestSingleSignOn = async () => { // if client.accounts in localStorage is empty - !isClientAccountsPopulated // and if feature flag for OIDC Phase 2 is enabled - isAuthEnabled if (isLoggedInCookie && !isCallbackPage && !isEndpointPage && !isClientAccountsPopulated && isAuthEnabled) { + const currentLanguage = Language.get(); await requestOidcAuthentication({ - redirectCallbackUri: `${window.location.origin}/en/callback`, + redirectCallbackUri: `${window.location.origin}/${currentLanguage}/callback`, }); } };