I want to know how can I register user using rest api.
I am calling api http://localhost:8042/auth/admin/realms/rds-dev/users to register user.
but the response is 403 forbidden.
In realm configuration make sure to allow user registration.
Try these curls
first obtain token from authenticating via a client app:
curl --location 'http://localhost:8080/realms/dummy-realm/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=dummy-client' \
--data-urlencode 'client_secret=Y4iTmfiqWSkjrDylL6biX3Q1UZxAO7ZN' \
--data-urlencode 'grant_type=client_credentials'
get the access_token from response and put it in the second curl
curl --location 'http://localhost:8080/admin/realms/dummy-realm/users' \
--header 'Authorization: Bearer <access_token>' \
--header 'Content-Type: application/json' \
--data-raw '{
"username": "lama123",
"enabled": true,
"email": "abc@defg.com",
"firstName": "Lama",
"lastName": "Alosaimi",
"credentials": [
{
"type": "password",
"value": "lama123",
"temporary": false
}
]
}'
1 Like
Hi!
Thank you for your help. I managed to make it work
1 Like
