问题描述
在 Keycloak 服务器中,我们创建了一个 Access Type
为 confidential
的客户端。
通过使用 /protocol/openid-connect/token
和 client_id
调用 client_secret
端点,我们得到了 access_token
,它应该对后续请求中的相关应用程序(客户端)进行身份验证.
即使令牌有效(我通过调用 introspect
端点进行了双重检查),对于具有此 access_token
的任何请求,我都会从服务器收到 500 错误
简而言之:
- 调用此端点
<base_url>/auth/realms/<realm>/protocol/openid-connect/token
会提供一个 access_token- 提供的数据:client_id、client_secret、grant_type:“client_credentials”
- 调用
<base_url>/auth/realms/<realm>/protocol/openid-connect/userinfo
给出500Internal Server Error
{
"error": "unkNown_error"
}
对可能是什么问题的任何见解?
解决方法
这应该在 Keycloak 13.0.0 中修复。 查看此提交:https://github.com/keycloak/keycloak/commit/056b52fbbe5af06aab957d37405215f1f4ed6ecd
,从您如何将令牌发送到 userInfo 端点的问题中并不清楚,只要您收到的访问令牌有效,请确保您在请求标头中发送令牌。试试下面的 curl 命令:-
curl
-X GET
-H "Authorization: Bearer <Access Token>"
-H "Content-type: application/json"
http://{hostname}/auth/realms/{realm_name}/protocol/openid-connect/userinfo