7.2.2. 发出请求
当客户端交换为另一个客户端令牌的现有令牌时,您可以使用 使用者 参数。此参数必须是您在管理控制台中配置的目标客户端的客户端标识符。
curl -X POST \
-d "client_id=starting-client" \
-d "client_secret=the client secret" \
--data-urlencode "grant_type=urn:ietf:params:oauth:grant-type:token-exchange" \
-d "subject_token=...." \
--data-urlencode "requested_token_type=urn:ietf:params:oauth:token-type:refresh_token" \
-d "audience=target-client" \
http://localhost:8080/auth/realms/myrealm/protocol/openid-connect/token
subject_token 参数必须是目标域的访问令牌。如果您的 requested_token_type 参数是刷新令牌类型,则响应将包含访问令牌、刷新令牌和过期。以下是您从此调用返回的示例 JSON 响应:
{
"access_token" : "....",
"refresh_token" : "....",
"expires_in" : 3600
}