Skip to content

Commit

Permalink
Always redirect to endpoint (#349)
Browse files Browse the repository at this point in the history
* Always redirect to endpoint

* Update packages/zudoku/src/lib/authentication/providers/auth0.tsx

Co-authored-by: Dan <[email protected]>

* Update auth0.tsx

---------

Co-authored-by: Dan <[email protected]>
  • Loading branch information
mosch and dan-lee authored Nov 25, 2024
1 parent 57006a5 commit f00b476
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/zudoku/src/lib/authentication/providers/auth0.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,10 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
// Logout End Session Endpoint Discovery is enabled by default.
// Otherwise we fallback to the old non-compliant logout

let logoutUrl: URL;
// The endSessionEndpoint is set, the IdP supports some form of logout,
// so we use the IdP logout. Otherwise, just redirect the user to home
if (as.end_session_endpoint) {
logoutUrl = new URL(as.end_session_endpoint);
const logoutUrl = new URL(as.end_session_endpoint);
// TODO: get id_token and set hint
// const { id_token } = session;
// if (id_token) {
Expand All @@ -57,8 +56,11 @@ class Auth0AuthenticationProvider extends OpenIDAuthenticationProvider {
"post_logout_redirect_uri",
redirectUrl.toString(),
);

window.location.href = logoutUrl.toString();
} else {
logoutUrl = new URL(`${this.issuer}oidc/logout`);
const logoutUrl = new URL(`${this.issuer.replace(/\/$/, "")}/oidc/logout`);
window.location.href = logoutUrl.toString();
}
};
}
Expand Down

0 comments on commit f00b476

Please sign in to comment.