let's say we have a domain on www.example.com
and the auth server is on auth.example.com
After login, it sets some cookies with these values :
I need to access cookies in www.example.com
as well. Any idea how to ask Keycloak to support parent domain ? (have a feeling Path is the problem here but couldn't find a way to change it from KC config)
Changing the Keycloak cookie domain or path is not supported. The keycloak cookie will always be scoped to the realms domain & path.
For some context:
That cookie must only be used by the Keycloak Realm.
Your app at www.example.com
must set its own cookie.
When a user attempts to login:
Your app will send that user to the appropriate keycloak realm.
Once the user logs in (i.e. successfully authenticates) at the keycloak realm
Your app will use this information in the URL and use it to verify if the authentication was indeed successful.
After verification, your app will now set a cookie.
Your application will now use the cookie set by your application for authentication. Ofcourse, you can use a JWT token, etc. You are not limited to cookies. The point here is, you use your cookie, the keycloak realm uses its cookie.
I basically just described the OpenID Connect Authorization Code Flow above. I recommend reading about it. Most languages have an implementation you should be able to use with very little code.