如何激活keycloak的REST API? [英] How to activate the REST API of keycloak?

查看:173
本文介绍了如何激活keycloak的REST API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了密钥克隆服务器4.3.4. 如何激活keycloak的REST API(添加用户,已启用用户,已禁用用户...)?

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

致谢

推荐答案

要做的第一步是创建一个管理员帐户(打开

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 ).

下一步取决于您要如何创建配置.通过管理控制台GUI或Rest API.

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

  1. 首先,您必须从 {keycloak-url}/中获取令牌auth/realms/master/protocol/openid-connect/token 像这样:
  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. 从上述调用中获得令牌后,就可以在其他Bearer token_value设置Authorization标头,调用="noreferrer"> Admin Rest API . (将token_value替换为上述步骤1中获得的值)
  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)

(在下面的示例Rest调用中共享一个获取用户列表的示例- https://www.keycloak.org/docs-api/10.0/rest-api/index.html#_users_resource )

(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 )

这篇关于如何激活keycloak的REST API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆