问题
I want to create a new user in keycloak using postman.
I get a token running
https://xxxxxx/auth/realms/MyRealm/protocol/openid-connect/token
header:
Content-Type:application/x-www-form-urlencoded
body:
grant_type:password
client_id:admin-cli
client_secret:asdf-asdf-asdf-asdf-asdf
username:testuser1
password:1234
If I then try to create a new user I get a 404 or 401 depending on the address.
404: https://xxxxxx/auth/realms/MyRealm/users
401: https://xxxxxx/auth/admin/realms/MyRealm/users
header:
Authorization Bearer asdfasdfasdfasdfasdfasdf
Content-Type application/json
no body: // The error is the same even with body
I suppose that when using auth/admin I also need a token for the auth/admin but I have no idea how to do it.
If I try to get a token for the same or admin user under auth/admin, in both cases I get a 401.
Using the admin user credentials to get a token under /auth/realms results in a 401 Invalid user credentials.
Any ideas?
来源:https://stackoverflow.com/questions/59157519/create-a-new-user-in-keycloak-using-postman