如果我有一个用户在领域 R 下使用公共客户端 C1 使用 keycloak 进行身份验证,是否有一个端点可以在 keycloak 中命中,它将为同一领域 R 下的不同公共客户端 C2 生成新的访问令牌?
[更新 #1] 我尝试使用刷新令牌为 C2 客户端获取新的访问令牌,但出现以下错误:
Invalid refresh token. Token client and authorized client don't match
[更新#2] 所以,上面给了我尝试使用交换令牌授权类型的想法,我现在可以使用它了。
curl --request POST \
'https://myhost.com.au/auth/realms/<my realm>/protocol/openid-connect/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'grant_type=urn:ietf:params:oauth:grant-type:token-exchange' \
--data-urlencode 'subject_token=<c1 access token>' \
--data-urlencode 'subject_token_type=urn:ietf:params:oauth:token-type:access_token' \
--data-urlencode 'requested_token_type=urn:ietf:params:oauth:token-type:refresh_token' \
--data-urlencode 'client_id=<c2 client id>'