我如何解决客户端需要用户在 keycloak 中的同意?

How can I resolved Client requires user consent in keycloak?

我需要在创建用户时在 keycloak 用户中添加用户同意。我正在使用 API

http://localhost:8080/auth/admin/realms/master/users

并打开并尝试创建用户,但出现如下错误:

Client requires user consent

我不知道我需要传递哪个参数来修复这个错误。

什么是同意?

Consent is when you as an admin want a user to give permission to a client before that client can participate in the authentication process. After a user provides their credentials, Keycloak will pop up a screen identifying the client requesting a login and what identity information is requested of the user. User can decide whether or not to grant the request.

那么通过api或curl命令

创建用户的过程是怎样的
  1. 在userid/password/client/realm信息的帮助下生成令牌
  2. 现在将此令牌传递给创建用户 restapi 或带日期的 curl 命令[username/emailid...] 等等

所以在你的情况下,你遇到了关于

的问题
Client requires user consent

所以这意味着在您的客户端(用于生成令牌)中,Consent Required 选项是 true 代替 false。 要么 您使用错误的客户端创建用户。

仅供参考:- 通常我们有两个不同的客户端用于后端和前端应用程序,但存在一些主要差异。