I am trying to add a user in keyclaok server using postman but i am not able to create.
Postman request:
Method: POST URL: http://localhost:8080/auth/admin/realms/ctms/users
Header: Auth
Request JSON Type in Body:
{
"enabled": true,
"attributes": {},
"emailVerified": "",
"firstName": "DDDDDD",
"lastName": "WWWWWWW",
"email": "wwww@aaa.com"
}
Getting Response 403 Forbidden
{ "error": "unknown_error" }
I am making a custom lonin page with New User & Sign-up user option but i am not able to create new user If anyone please tell me how to add new user in keyclaok using postman
You are getting a 403 Error because you are not passing the right bearer token. Here is an example
curl --location --request POST 'http://localhost:8080/auth/admin/realms/demo/users' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {token}' \
--data-raw '{"username" : "bburke",
"enabled": "true"
You can get the admin token using the below command
curl --location --request POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'username=admin' \
--data-urlencode 'password=admin' \
--data-urlencode 'grant_type=password' \
--data-urlencode 'client_id=admin-cli'
In place of username and password you need to provide the admin username and password and your client_id
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.