HTTP Status Code for Authenticated but Unauthorized?
With which HTTP status code should a REST API respond if the request is authenticated (according to The OAuth 2.0 Authorization Framework: Bearer Token Usage: Authorization Request Header Field) but the authenticated user is unauthorized to view the resource being requested?
For example, imagine I make a request to see a certain user's profile: GET /users/123
. I authenticate successfully, but that user has blocked me. With which HTTP status code should the server respond?
Related:
The code you need is 403 Forbidden
:
From wikipedia:
A 403 response generally indicates one of two conditions:
上一篇: 身份验证v / s授权
下一篇: HTTP状态代码进行身份验证但未经授权?