gpt4 book ai didi

security - 为什么响应 "client_credentials"授权的 OAuth2 服务器不提供 refresh_token?

转载 作者:行者123 更新时间:2023-12-03 21:14:38 25 4
gpt4 key购买 nike

我正在阅读 OAuth2 规范:
https://www.rfc-editor.org/rfc/rfc6749#section-4.4.2
特别是关于 client_credentials 的部分授予类型。

If the access token request is valid and authorized, the
authorization server issues an access token as described in Section5.1.
A refresh token SHOULD NOT be included. If the request failed client authentication or is invalid, the authorization serverreturns an error response as described in Section 5.2.


成功响应示例:
 HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
Cache-Control: no-store
Pragma: no-cache

{
"access_token":"2YotnFZFEjr1zCsicMWpAA",
"token_type":"example",
"expires_in":3600,
"example_parameter":"example_value"
}
`

我有点困惑为什么授权服务器可以返回 password 的 refresh_tokens授予类型,但不适用于 client_credentials .
我猜这与 refresh_token 可以交换为 access_token 的事实有关,并且因为 client_credentials 授权类型不需要用户名和密码,如果您的应用程序 key 和 refresh_token 被泄露,撤销变得很多更加困难?

最佳答案

理解这一点的关键部分是 refresh概念不是为您设计来刷新您已经拥有的任何访问 token 。

“刷新 token ”只是一种跳过最终用户干预并仍然重新获得新访问 token 的方法,如果您的应用程序使用最终用户用户名/密码身份验证,即代表特定最终用户行事。 (如果我是设计师,我可能会将“刷新 token ”命名为“绕过用户干预 token ”,因此不需要问当前问题。)

但是,如果您的应用程序使用客户端凭据进行身份验证,则它代表自己进行操作,您根本不需要用户干预,服务器也不需要(也不会)给您刷新 token .

关于security - 为什么响应 "client_credentials"授权的 OAuth2 服务器不提供 refresh_token?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29233772/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com