【发布时间】:2021-11-14 17:39:43
【问题描述】:
我想使用 JWT 进行身份验证,所以我尝试使用 Keycloak 来获取 Bearer 令牌。我的问题是,当我在请求中设置 scope=openid 时。响应包含 access_token 和 id_token 作为打击:
{
"access_token": "eyJAlW7lLfxPta...MS85g",
"expires_in": 300,
"refresh_expires_in": 1800,
"token_type": "Bearer",
"id_token": "eyJhbGciOmQtMzJhOThS...Htm2OSGo9pVs-CWBJGaPC2Z2ib6FSSckzTxA",
"not-before-policy": 0,
"session_state": "d76a27af-3780-4843-9c6d-32a98c1f6625",
"scope": "openid"
}
据我所知,access_token 用于授权,我不需要它。我只需要id_token 进行身份验证。是否可以从 Keycloak 响应中删除 access_token,或者它只是一个全局 OIDC 规则,id_token 总是带有 access_token?我是否使用了正确的令牌或身份验证必须由 access_token 完成?
【问题讨论】:
标签: oauth-2.0 jwt keycloak openid-connect