Cookie Token Store How To

Hello guys,

We’ve recently upgraded to Keycloak 9.0.0 in order to use the Cookie Token Store in the Spring Boot Adapter.

For the moment, we only set the parameter “keycloak.token-store=COOKIE” for the adapter.

We were looking for some documentation about how to use it correctly.

We have two use cases:

  1. Users authentication to our webapp (using Keycloak of course) in a browser

  2. Users authentication to our REST API (using Keycloak of course) via HTTP requests

For 1), we would like to use a standard authentication flow (access_token, refresh_token in HTTP session).

For 2), we would like to use the “Token Store Cookie mode” and exchange the authentication information via the “KEYCLOAK_ADAPTER_STATE” cookie.

We read the Spring Boot Keycloak filters and other Spring Boot adapter classes just to know how the KEYCLOAK_ADAPTER_STATE is managed, but we cannot find how to get this cookie :’(

Could you please give us some example, documentation,…?

Thanks a lot for your help!