You signed i
8000
n with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Configurable token issuer (or the validation of it) #40031
In !22191 verification of the iss claim in the refresh token has been added. This verification is not optional, and completely based on the current request URI. There is no option to define the issuer value, it is derived from the request at sign-in. There is basically no control on setting the issuer claim value, and the introduced verification cannot be disabled or replaced in anyway (e.g. via a SPI).
This becomes problematic if you want to use the same refresh token from different subdomains as the subdomain during sign-in might different from the domain during the refresh request.
Discussion
No response
Motivation
Our platform setup uses two subdomain to serve some different things, e.g.
Common functionality is reachable on either subdomain (which includes Keycloak). And then there are a bunch of services for which we host different versions on the primary and secondary subdomain. Users can authenticate via either subdomain, and use that authentication for either subdomain. There should be able to freely move to either domain.
With the iss verification if the user authenticates via https://primary.example.net the issuer will be that, but then the user will eventually get a token problem when working within https://secondary.example.net as the request for refresh is routed through the secondary subdomain.
You could say that the applications should always communicate to a specific host. But that introduces CORS complexity just to get around the way Keycloak performs the iss verification. Also a SPA suddenly needs to know the host of keycloak instead of just talking to a relative path within the current subdomain.
If Keycloak would allow explicitly configuring the issuer to a URN it would solve this whole problem. (When not configured the current behavior would be used).
I think you have a missunderstanding how you should use keycloak.
When you request a token, then the hostname which you have used is the issuer of the token.
There is not really a RFC compliant way around this.
You should better think about to expose the keycloak with one central hostname and all your applications should use this central fixed hostname to access the keycloak infrastructure.
You should read the linked comment from a older "Not Planned" issue. #27660 (comment)
This usage requirement nicely buried in different specs, and half pulled in on the main spec from an optional part of OIDC. It is definitely not clear from the spec, nor Keycloak documentation that you are bound to a single host for anything OAuth2 due to OIDC + OIDC Discovery requirements. But I guess people starting out with Keycloak since 23 will figure that out in an earlier state instead after an upgrade.
This requirement does introduce complications with common SPAs development practices when you want/need to provide more than one version of that software. Then you would probably also need to implement OIDC Discovery's Issuer discovery. Or some other construction to find the correct absolute URI, instead of making use of relative URIs.
Using a central fixed hostname is for our case is a definite no-go the same service is reachable (but not inter exchangeable) from different domains. (You know, locked out internet access from certain client locations.) It is also not practical for DTAP situations.
Either way, thanks for the response and reference to more information.
As configurable token issuer or the validation of it are basically non-conforming to the OIDC standard I should close it request.
Activity
gruummy commentedon Jul 26, 2025
I think you have a missunderstanding how you should use keycloak.
When you request a token, then the hostname which you have used is the issuer of the token.
There is not really a RFC compliant way around this.
You should better think about to expose the keycloak with one central hostname and all your applications should use this central fixed hostname to access the keycloak infrastructure.
You should read the linked comment from a older "Not Planned" issue.
#27660 (comment)
elmuerte commentedon Aug 6, 2025
Apparently.
This usage requirement nicely buried in different specs, and half pulled in on the main spec from an optional part of OIDC. It is definitely not clear from the spec, nor Keycloak documentation that you are bound to a single host for anything OAuth2 due to OIDC + OIDC Discovery requirements. But I guess people starting out with Keycloak since 23 will figure that out in an earlier state instead after an upgrade.
This requirement does introduce complications with common SPAs development practices when you want/need to provide more than one version of that software. Then you would probably also need to implement OIDC Discovery's Issuer discovery. Or some other construction to find the correct absolute URI, instead of making use of relative URIs.
Using a central fixed hostname is for our case is a definite no-go the same service is reachable (but not inter exchangeable) from different domains. (You know, locked out internet access from certain client locations.) It is also not practical for DTAP situations.
Either way, thanks for the response and reference to more information.
As configurable token issuer or the validation of it are basically non-conforming to the OIDC standard I should close it request.