Skip to content

Commit 81e03da

Browse files
Merge pull request #152 from adrienne-deriv/fix-logout-redirect-uri
Fix logout redirect uri wrong url reconstruction
2 parents f977b5d + e409673 commit 81e03da

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/constants/__tests__/urls.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('URLs', () => {
114114

115115
const oauthUrl = getOauthUrl();
116116

117-
expect(oauthUrl).toBe('https://qa.deriv.com/oauth2/authorize?app_id=67890&l=EN&&brand=deriv');
117+
expect(oauthUrl).toBe('https://qa.deriv.com/oauth2/authorize?app_id=67890&l=EN&brand=deriv');
118118
});
119119

120120
it('should return the default OAuth URL if appId and serverUrl are not set', () => {
@@ -136,7 +136,7 @@ describe('URLs', () => {
136136

137137
const oauthUrl = getOauthUrl();
138138

139-
expect(oauthUrl).toBe('https://qa.deriv.com/oauth2/authorize?app_id=67890&l=EN&&brand=deriv');
139+
expect(oauthUrl).toBe('https://qa.deriv.com/oauth2/authorize?app_id=67890&l=EN&brand=deriv');
140140
});
141141
});
142142

src/oidc/oidc.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const requestOidcAuthentication = async (options: RequestOidcAuthenticati
133133

134134
await userManager.signinRedirect({
135135
extraQueryParams: {
136-
brand: "deriv"
136+
brand: 'deriv',
137137
},
138138
});
139139
return { userManager };
@@ -287,14 +287,15 @@ export const OAuth2Logout = async (options: OAuth2LogoutOptions) => {
287287
const oidcEndpoints = localStorage.getItem('config.oidc_endpoints') || '{}';
288288

289289
let logoutUrl = getOAuthLogoutUrl() || JSON.parse(oidcEndpoints).end_session_endpoint;
290-
const userManager = await createUserManager({
291-
redirectCallbackUri: options.redirectCallbackUri,
292-
postLogoutRedirectUri: options.postLogoutRedirectUri,
293-
});
294-
const userState = await userManager.getUser();
295-
if (userState?.id_token) {
296-
logoutUrl += `?id_token_hint=${userState.id_token}&post_logout_redirect_uri${options.postLogoutRedirectUri}`;
297-
}
290+
// NOTE: Comment this out once front channel is implemented
291+
// const userManager = await createUserManager({
292+
// redirectCallbackUri: options.redirectCallbackUri,
293+
// postLogoutRedirectUri: options.postLogoutRedirectUri,
294+
// });
295+
// const userState = await userManager.getUser();
296+
// if (userState?.id_token) {
297+
// logoutUrl += `?id_token_hint=${userState.id_token}&post_logout_redirect_uri=${options.postLogoutRedirectUri}`;
298+
// }
298299

299300
const cleanup = () => {
300301
const iframe = document.getElementById('logout-iframe') as HTMLIFrameElement;

0 commit comments

Comments
 (0)