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

post_logout_redirect_uri not set by logoutUrl if id hint is missing #420

Open
kbrabrand opened this issue Sep 2, 2022 · 1 comment · May be fixed by #421
Open

post_logout_redirect_uri not set by logoutUrl if id hint is missing #420

kbrabrand opened this issue Sep 2, 2022 · 1 comment · May be fixed by #421

Comments

@kbrabrand
Copy link

Describe the bug

The logoutUrl function on the Keycloak prototype takes to parameters. The first one redirectUrl is required, whilst the idTokenHint is an optional parameter (per the TS types).

However – if the idTokenHint is not provided, the redirectUrl is not included, because of this check 👇

if (redirectUrl && idTokenHint) {
  url.searchParams.set('id_token_hint', idTokenHint)
  url.searchParams.set('post_logout_redirect_uri', redirectUrl)
}

Version

15.1.1 (server) - 19.0.1 (keycloak-connect)

Expected behavior

When calling the logoutUrl method from the Keycloak prototype, passing a redirectUrl I expect the redirectUrl to be included in the logoutUrl returned. Regardless of whether or not the idTokenHint is provided.

Actual behavior

If no idTokenHint is passed to the Keycloak.prototype.logoutUrl method the redirectUrl is not appended either. It's either idTokenHint+redirectUrl or nothing at all.

How to Reproduce?

const kc = new Keycloak(...)

// this one will include the redirectUrl
kc.logoutUrl('https://where.to.go', 'id123')

// this one won't include the redirectUrl, because of the missing id token hint
kc.logoutUrl('https://where.to.go')

Anything else?

No response

kbrabrand added a commit to kbrabrand/keycloak-nodejs-connect that referenced this issue Sep 2, 2022
@claudiunicolaa
Copy link

claudiunicolaa commented Sep 14, 2022

This sounds legit taking into consideration the client_id query param was added to logout keycloak/keycloak#12002 (comment)

When client_id parameter is used and id_token_hint is NOT used and post_logout_redirect_uri is used ...

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

Successfully merging a pull request may close this issue.

2 participants