You signed in 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
The keycloak-js client library (https://github.com/keycloak/keycloak/tree/main/adapters/oidc/js) needs some changes in the refresh token. it expects a kind-of proper token where it wants to decode the second part of a string separated by a . and wants to check the nonce in it. My evil hack, which does work, for generating the refresh token looks like the following, whereas the nonce is passed down from AuthorizationCodeHandler.tokenResponse.
val jti =UUID.randomUUID().toString()
val refreshToken =if (nonce !=null) "."+Base64.getEncoder().encodeToString("{\"nonce\":\"$nonce\",\"jti\":\"$jti\"}".toByteArray()) else jti
That sounds really strange - the refresh token is supposed to be an opaque string containing whatever. Do you mean that keycloak requires the refresh token to be a JWT? Maybe I havent understood the use case right - could you elaborate a bit more on what you send, what you receive and what errors keycloak-js is reporting?
Any ideas how to handle this case? Being compatible with keycloak-js would obviously be nice, though I would understand the hesitation considering the "re-interpretation" of the specifications by Keycloak server and client.
The text was updated successfully, but these errors were encountered:
Any thoughts on how to handle the keycloak specs interpretation? I guess it come down to these options:
Just ignore this requirement since according to specs the refresh token is supposed to be just opaque string, which in turn make this project unfortunately incompatible with the keycloak client library
Take over my "hacky" solution which just implements the bare minimum to reach compatibility
@jp7677 sorry about the late response! I'm thinking we should implement this so that keycloak client can be used, it is a minor change after all and shouldn't affect other clients. Haven't decided if we should go the "hacky" route or go with a proper signed JWT - it does seem that the keykloak client only decodes and not validates the token so that leaves all possibilities open :)
* feat: support keycloak refresh token format
* includes nonce from auth request in a plain JWT
* see #210
Co-authored-by: Youssef Bel Mekki <[email protected]>
This is a follow up from #199 (comment)
The keycloak-js client library (https://github.com/keycloak/keycloak/tree/main/adapters/oidc/js) needs some changes in the refresh token. it expects a kind-of proper token where it wants to decode the second part of a string separated by a . and wants to check the nonce in it. My evil hack, which does work, for generating the refresh token looks like the following, whereas the nonce is passed down from AuthorizationCodeHandler.tokenResponse.
Response from @tommytroen :
Response from @jp7677 :
Any ideas how to handle this case? Being compatible with keycloak-js would obviously be nice, though I would understand the hesitation considering the "re-interpretation" of the specifications by Keycloak server and client.
The text was updated successfully, but these errors were encountered: