Skip to content

Commit

Permalink
Merge pull request #127 from thisyahlen-deriv/thisyahlen/swap-logout-uri
Browse files Browse the repository at this point in the history
chore: swap logout uri logic
  • Loading branch information
thisyahlen-deriv authored Dec 18, 2024
2 parents 1d5a088 + f1a7cab commit 995ba95
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/oidc/oidc.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UserManager, WebStorageStateStore } from 'oidc-client-ts';
import { OIDCError, OIDCErrorType } from './error';
import { getServerInfo, DEFAULT_OAUTH_LOGOUT_URL } from '../constants';
import { getServerInfo, getOAuthLogoutUrl } from '../constants';
import { getConfigurations } from './config';
import Cookies from 'js-cookie';

Expand Down Expand Up @@ -270,11 +270,9 @@ export const createUserManager = async (options: CreateUserManagerOptions) => {
*/
export const OAuth2Logout = (WSLogoutAndRedirect: () => void) => {
const oidcEndpoints = localStorage.getItem('config.oidc_endpoints') || '{}';
const serverUrl = localStorage.getItem('config.server_url') || '';

const logoutUrl =
JSON.parse(oidcEndpoints).end_session_endpoint ||
(serverUrl ? `https://${serverUrl}/oauth2/sessions/logout` : DEFAULT_OAUTH_LOGOUT_URL);
const logoutUrl = getOAuthLogoutUrl() || JSON.parse(oidcEndpoints).end_session_endpoint;

const cleanup = () => {
const iframe = document.getElementById('logout-iframe') as HTMLIFrameElement;
if (iframe) iframe.remove();
Expand Down

0 comments on commit 995ba95

Please sign in to comment.