How to activate the REST API of keycloak?

亡梦爱人 提交于 2020-06-11 18:06:27

问题


I have installed keycloack server 4.3.4. How to activate the REST API of keycloak (Add a user, enabled user, disabled a user ...) ?

Regards


回答1:


First step to do that is create an admin account (which you would have been prompted to do as soon as you would have opened {keycloak-url}/auth ).

Next steps depend on how you want to create config. Through Admin console GUI or through Rest API.

Steps to do this through Admin Rest API.

  1. First , you will have to get a token from {keycloak-url}/auth/realms/master/protocol/openid-connect/token like this:

Note that only change you have to do in below call is your keycloak server address and value of admin username and password.

  1. Once you obtain a token from above call, you can use it on other Admin Rest API calls by setting Authorization header, with Bearer token_value. (replace token_value with one obtained in step 1 above)

(Sharing an example below of sample rest call which gets list of users - https://www.keycloak.org/docs-api/10.0/rest-api/index.html#_users_resource )

{{SERVER}}/auth/admin/realms/myRealm/users



来源:https://stackoverflow.com/questions/53283281/how-to-activate-the-rest-api-of-keycloak

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