Can I log in an user's account on a website using an access token ?

Hi all,

I am looking for a solution to automatically log in a user on front (html/angularjs) using an access token.

This token was previously requested to Keycloak in order to call API of the back server (java spring).

Is it possible to do that ?

If it doesn’t, maybe the reverse operation is ?

Yes, you can just use the JS Adapter
https://www.keycloak.org/docs/latest/securing_apps/#_javascript_adapter

When creating the adapter you can pass in the token of the user.

Hum, ok, interesting…

Thank for your reply.

I’ll try to implement this adapter initailizing it with, I see, token, refreshToken and idToken init options.

But, as I have a spring webapp behind, I’m douting about how to do this implementation.
Maybe a first html page using this js adapter in order to initialize session and a redirect to my app pages after successfull init.

I’ll try it.