Keycloak automatic login after registration via API

Viewed 942

A React SPA sends registration details to a backend (including username and password). Besides other things, the backend creates a keycloak user via the REST admin API.

The user then still needs to go to the keycloak login page for authentication. Is it possible to skip this step and automatically log-in the user on registration via API?

I thought if maybe the backend can obtain a token and send it to the SPA. But I do not know how to initialize keycloak-js in this scenario.

1 Answers

You can register the user and, after a successful registration, call the login endpoint with the same credentials in order to receive the access token.

Update: Sequence diagram of registration flow

Related