Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logout with Keycloak 18+ not working #537

Open
j-qby opened this issue Aug 30, 2022 · 0 comments
Open

Logout with Keycloak 18+ not working #537

j-qby opened this issue Aug 30, 2022 · 0 comments

Comments

@j-qby
Copy link

j-qby commented Aug 30, 2022

Issue Summary
Keycloak 18 has changed the logout mechanism to be more OIDC-compliant. It now requires a post_logout_redirect_uri (note the difference ..._uri vs. ..._url) and an id_token_hint for an RP-Initiated Logout. Previous versions used redirect_uri, implemented here:

let redirectUrl =
(this.$config.provider == 'keycloak'
? 'redirect_uri='
: 'post_logout_redirect_url=') +
this.$store.getters['auth/getOptions']['providers'][this.$config.provider]['redirectUri'] +
'/logout'
window.location.href = response.data.logoutUrl + '?' + redirectUrl

Keycloak no longer accepts the query parameter and the logout fails with Invalid parameter: redirect_uri.

Environment

  • OS: Linux

  • API version: any

  • Deployment: Docker, self-hosted, any...

  • For self-hosted, WSGI environment: any

  • Database: Postgres, any

  • Server config:
    Auth enabled? Yes
    Auth provider? Keycloak
    Customer views? No
    (or provide the /config endpoint output)

  • web UI version: latest master

  • CLI version: latest master

To Reproduce
Steps to reproduce the behavior:

  1. Configure Alerta to use a Keycloak 18+ instance
  2. Login
  3. Profile > Logout
  4. Observe error

We are sorry...
Invalid parameter: redirect_uri

For web app issues, include any web browser JavaScript console errors.

Expected behavior
Logout and redirect successful

Additional context
I tried sending the this.$store.state.auth.token as id_token_hint but that failed. I guess it is the auth token, not the ID token.

To make it all happen, we would need to identify if a Keycloak instance previous to version 18 is used, or an 18+ one. Not sure if this can be identified from client side, or if the user needs to configure it explicitly. Also we need to store the ID token in order to send it on logout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant