Skip to content

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

@kbrabrand

Description

@kbrabrand

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions