Hi,
I'm trying to setup a test app in docker containers. It consist of the following apps in a docker-compose:
- Keycloak + posgresql
- A Simple NodeJS app that has routes protected via RBAC (using keycloak-connect), this is configured with a bearer only client
- A React App (using @react-keycloak/web), this is configured with a public client
The above 3 apps have service names in the docker-compose file and are all port mapped to localhost under different ports.
The issue I am running into now is that after I login with the react app, the token i receive has an issuer host of "localhost", while the NodeJS app expects the service name "keycloak" as the host instead. Attempting to use the token anyway results in a mismatch issuer error being thrown.
I understand the following from this and my testing:
- frontendUrl is configurable, and can be used to override the issuer for all requests for tokens
- This should be used for front-end URLs as the name of the property "frontendUrl" implies as it modifies the issuer, authorization_endpoint, end_session_endpoint, and check_session_iframe values in the well-known openid discovery point to be the same as its configured value
- token_endpoint, introspection_endpoint, userinfo_endpoint, and jwks_uri will remain as the incoming request host as they are considered "backend" values
- there is another property "forceBackendUrlToFrontendUrl", which i assume will force the backend url to be the frontend url, effectively making every request return only the frontend url as the issuer in tokens
- frontendUrl can be overriden through a realm level config
What I don't understand is, how this fits into resolving the issues. I've tried the following:
- Setting the frontendURL to localhost, this doesn't change anything as the keycloak-connect library does not have a separate configurations for the specifying back channel, and frontend urls, the only configurable URL i can find is "authServerUrl", which is used for everything else
- Setting the frontendURL to "keycloak" (the backend expected value), this might have worked, however, it seems to override the redirect value of the login process, so after login, i get redirected back to the domain "keycloak" instead of the domain "localhost" even though its the domain listed on the query param.
- Based on the description of "forceBackendUrlToFrontendUrl", i do not think that would help in any way, so i've ignored it.
Has anyone solved this issue? and if so, what did you do to resolve it? From what I can tell, i don't think my particular issue is resolvable with the default host provider. The most straight forward solution seems to be allowing multiple issuers like the original ticket suggested. But as there was no other activities on those tickets after they where closed, and no new ones where created, I assumed I am missing something obvious here...
Thanks,
Andy