Skip to content

Commit

Permalink
Merge branch '2362-okta' into staging
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Dec 21, 2023
2 parents 7be662c + abaa29c commit 47552f1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/common/services/session/session.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ const session = /* @ngInject */ function ($cookies, $rootScope, $http, $timeout,
await clearCheckoutSavedData()
await authClient.revokeAccessToken()
await authClient.revokeRefreshToken()
await authClient.closeSession()
// Add session data so on return to page we can show an explaination to the user about what happened.
if (!redirectHome) {
$window.sessionStorage.setItem('forcedUserToLogout', true)
Expand All @@ -302,7 +303,17 @@ const session = /* @ngInject */ function ($cookies, $rootScope, $http, $timeout,
postLogoutRedirectUri: redirectHome ? null : $window.location.href
})
} catch {
$window.location = `https://signon.okta.com/login/signout?fromURI=${envService.read('oktaReferrer')}`
// closeSession errors out due to CORS. to fix this temporarily, I've added the logout in a catch just in case.
try {
if (!redirectHome) {
$window.sessionStorage.setItem('forcedUserToLogout', true)
}
return authClient.signOut({
postLogoutRedirectUri: redirectHome ? null : $window.location.href
})
} catch {
$window.location = `https://signon.okta.com/login/signout?fromURI=${envService.read('oktaReferrer')}`
}
}
}

Expand Down

0 comments on commit 47552f1

Please sign in to comment.