Create a new user in Keycloak using Postman

末鹿安然 提交于 2021-02-08 07:21:25

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!