【发布时间】:2016-10-28 00:49:21
【问题描述】:
我正在阅读oauth2 specs,但我对unauthorized_client 和access_denied 错误代码感到困惑。它们似乎表达了相同的错误条件,不是吗?乍一看(通过错误代码),我认为一个是身份验证失败,另一个是授权失败,但它们实际上都是关于授权失败,这将转换为 http 403 状态代码。
unauthorized_client
The client is not authorized to request an access token
using this method.
access_denied
The resource owner or authorization server denied the
request.
【问题讨论】:
-
unauthorized_client 在您的 clientId 和 clientSecret 不匹配时出现。当您是合法用户但无权执行某些操作时,会出现 access_denied。
-
凭证(clientId 和 clientSecret)不匹配时不应该是身份验证错误吗?为什么会是未授权的_client?该描述还说“客户端无权请求访问令牌”并不是说客户端和秘密是错误的。顺便说一句,凭据不匹配存在特定错误:
invalid_grant-The provided authorization grant (e.g., authorization code, resource owner credentials) or refresh token is invalid, expired, revoked, does not match the redirection URI used in the authorization request, or or was issued to another client -
我发现的问题是这里的术语:在 OAuth 2.0 中,“客户端”是您的应用程序。用户被称为“资源所有者”......对于不阅读 RFC 的人来说很困惑......