【发布时间】:2021-04-26 01:55:36
【问题描述】:
我正在使用邮递员,我尝试通过 http://localhost:8180/auth/admin/realms/demo/users/{userID} 更新用户的个人资料,但我收到了 401 响应。
我使用的程序:
-
通过 http://localhost:8180/auth/realms/master/protocol/openid-connect/token 请求和接收管理令牌
-
以适当的方式向请求标头添加令牌,即授权:Bearer {access_token}
-
通过 http://localhost:8180/auth/admin/realms/demo/users/{userID} 发送带有 Json 内容类型和用户信息作为正文的 Put 请求。
很遗憾,我收到了连续的 401 响应。
第一个请求:
-Body(x-www-form-urlencoded)
client_id : admin_cli
username: ...
password: ...
grant_type: password
client_secret: ...
-致http://localhost:8180/auth/realms/master/protocol/openid-connect/token
第二次请求:
-Header -> 授权:Bearer ...
-正文(JSON)
"email": "d@gmail.com",
"firstName": "divad",
"lastName": "d"
-致http://localhost:8180/auth/admin/realms/demo/users/{userID}
【问题讨论】:
标签: java spring-boot postman keycloak keycloak-rest-api