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

Add client_id to logout url #425

Open
claudiunicolaa opened this issue Sep 14, 2022 · 1 comment
Open

Add client_id to logout url #425

claudiunicolaa opened this issue Sep 14, 2022 · 1 comment

Comments

@claudiunicolaa
Copy link

Description

In Keycloak 19 was added support for client_id as described in the OIDC RP-Initiated specification.
More details could be found here keycloak/keycloak#12002 (comment)

At this moment the library does not offer support for setting the client_id in the logout URL and the post_logout_redirect_uri query param is set only if idTokenHint function param is set.

Discussion

No response

Motivation

The library should match the Keycloak Server capabilities.

Details

The logout function should look like this

Keycloak.prototype.logoutUrl = function (redirectUrl, idTokenHint) {
    const url = new URL(this.config.realmUrl + '/protocol/openid-connect/logout')

    url.searchParams.set('client_id', this.config.clientId)

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

    return url.toString()
}

A part of the above implementation is already done #420.

@claudiunicolaa
Copy link
Author

I'm happy to create a PR for it, but first I'm waiting for a maintainer to take a look and validate that my idea looks good.

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

No branches or pull requests

1 participant