Keycloak change registration flow / create user API
Is this possible? For example, when a user fills the needed data, and clicks to register, I want to redirect him directly to my site and not to keycloak server ( profile manager ).
Yes. You can add a user via REST API.
Also, I am trying to add a user via API, using 'node.js', which would be the easiest way. However, it seems I can't get it done. Does anyone have or know of some kind of tutorial, that can help me, or point me in the right direction?
This is an example how to create a user using Keycloak REST API: https://github.com/v-ladynev/keycloak-nodejs-example/blob/master/lib/adminClient.js#L35
It doesn't throw any error. But in keycloak I can't see any new user.
Looks like, you provided incorrect parameters, or didn't provide mandatory parameters.
Mjafko
Updated on June 07, 2022Comments
-
Mjafko almost 2 years
Lately, I am playing with keylock server. I have an application which has a bit of complication in the registration flow, and I need to change the basic flow of keycloak. Is this possible? For example, when a user fills the needed data, and clicks to register, I want to redirect him directly to my site and not to keycloak server ( profile manager ).
Also, I am trying to add a user via API, using 'node.js', which would be the easiest way. However, it seems I can't get it done. Does anyone have or know of some kind of tutorial, that can help me, or point me in the right direction?
EDIT:
What I tried is create bash script and add user via rest
#!/bin/bash export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \ -H "Content-Type: application/x-www-form-urlencoded" \ -d "username=admin" \ -d 'password=admin' \ -d 'grant_type=password' \ -d 'client_id=admin-cli' | jq -r '.access_token') curl -X POST 'http://localhost:8080/auth/admin/realms/demo/users' \ -H "Accept: application/json" \ -d "username=abc -H "Authorization: Bearer $TKN" | jq .
It doesn't throw any error. But in keycloak I can't see any new user.