Keycloak 更改注册流程/创建用户 API
Keycloak change registration flow / create user API
最近在玩keylock服务器。我有一个注册流程有点复杂的应用程序,我需要更改 keycloak 的基本流程。这可能吗?例如,当用户填写需要的数据时,以及
单击注册,我想将他直接重定向到我的站点而不是 keycloak 服务器(配置文件管理器)。
此外,我正在尝试使用 'node.js' 通过 API 添加用户,这是最简单的方法。但是,我似乎无法完成它。有没有人知道或知道某种教程,可以帮助我,或者给我指明正确的方向?
编辑:
我尝试的是创建 bash 脚本并通过 rest 添加用户
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X POST 'http://localhost:8080/auth/admin/realms/demo/users' \
-H "Accept: application/json" \
-d "username=abc
-H "Authorization: Bearer $TKN" | jq .
它不会抛出任何错误。但是在keycloak中我看不到任何新用户。
Is this possible? For example, when a user fills the needed data, and clicks to register, I want to redirect him directly to my site and not to keycloak server ( profile manager ).
是的。您可以通过 REST API.
添加用户
Also, I am trying to add a user via API, using 'node.js', which would be the easiest way. However, it seems I can't get it done. Does anyone have or know of some kind of tutorial, that can help me, or point me in the right direction?
这是一个如何使用 Keycloak REST 创建用户的示例 API:
https://github.com/v-ladynev/keycloak-nodejs-example/blob/master/lib/adminClient.js#L35
It doesn't throw any error. But in keycloak I can't see any new user.
看起来,您提供的参数不正确,或者没有提供必填参数。
您将角色 managerusers 添加到您将在 keycloak 中创建新用户的用户
我想你问的问题可以分解为两个问题...
如何改变流量(这是我目前正在努力寻找的),
哪些 keycloak 命令行命令允许用户注册等。
这些应该是 CLI commands e.g. client-registration-cli,尽管正如你所说,还有一个 REST API。
最近在玩keylock服务器。我有一个注册流程有点复杂的应用程序,我需要更改 keycloak 的基本流程。这可能吗?例如,当用户填写需要的数据时,以及 单击注册,我想将他直接重定向到我的站点而不是 keycloak 服务器(配置文件管理器)。
此外,我正在尝试使用 'node.js' 通过 API 添加用户,这是最简单的方法。但是,我似乎无法完成它。有没有人知道或知道某种教程,可以帮助我,或者给我指明正确的方向?
编辑:
我尝试的是创建 bash 脚本并通过 rest 添加用户
#!/bin/bash
export TKN=$(curl -X POST 'http://localhost:8080/auth/realms/master/protocol/openid-connect/token' \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d 'password=admin' \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl -X POST 'http://localhost:8080/auth/admin/realms/demo/users' \
-H "Accept: application/json" \
-d "username=abc
-H "Authorization: Bearer $TKN" | jq .
它不会抛出任何错误。但是在keycloak中我看不到任何新用户。
Is this possible? For example, when a user fills the needed data, and clicks to register, I want to redirect him directly to my site and not to keycloak server ( profile manager ).
是的。您可以通过 REST API.
添加用户Also, I am trying to add a user via API, using 'node.js', which would be the easiest way. However, it seems I can't get it done. Does anyone have or know of some kind of tutorial, that can help me, or point me in the right direction?
这是一个如何使用 Keycloak REST 创建用户的示例 API: https://github.com/v-ladynev/keycloak-nodejs-example/blob/master/lib/adminClient.js#L35
It doesn't throw any error. But in keycloak I can't see any new user.
看起来,您提供的参数不正确,或者没有提供必填参数。
您将角色 managerusers 添加到您将在 keycloak 中创建新用户的用户
我想你问的问题可以分解为两个问题...
如何改变流量(这是我目前正在努力寻找的),
哪些 keycloak 命令行命令允许用户注册等。 这些应该是 CLI commands e.g. client-registration-cli,尽管正如你所说,还有一个 REST API。