I have seen the list of all HTTP status codes. However to me it looks like there is no code for \"email not verified\" (used for authentication/authorization). Did you ever had
The 4xx
class of status code is intended for situations in which the client seems to have erred:
6.5. Client Error 4xx
The
4xx
(Client Error) class of status code indicates that the client seems to have erred. Except when responding to aHEAD
request, the server SHOULD send a representation containing an explanation of the error situation, and whether it is a temporary or permanent condition. These status codes are applicable to any request method. User agents SHOULD display any included representation to the user.
For authentication and authorization, 401
and 403
are the proper status codes to be used, respectively. Regardless of the status code, you should always describe that reason of the error in the response payload.
401
UnauthorizedUse this status code for problems with HTTP authentication, that is, invalid credentials.
3.1. 401 Unauthorized
The
401
(Unauthorized) status code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource. The server generating a401
response MUST send aWWW-Authenticate
header field containing at least one challenge applicable to the target resource.If the request included authentication credentials, then the
401
response indicates that authorization has been refused for those credentials. The user agent MAY repeat the request with a new or replacedAuthorization
header field. If the401
response contains the same challenge as the prior response, and the user agent has already attempted authentication at least once, then the user agent SHOULD present the enclosed representation to the user, since it usually contains relevant diagnostic information.
403
ForbiddenUse this status code for problems with authorization, that is, the credentials are valid but they are insufficient to grant access.
6.5.3. 403 Forbidden
The
403
(Forbidden) status code indicates that the server understood the request but refuses to authorize it. A server that wishes to make public why the request has been forbidden can describe that reason in the response payload (if any).If authentication credentials were provided in the request, the server considers them insufficient to grant access. The client SHOULD NOT automatically repeat the request with the same credentials. The client MAY repeat the request with new or different credentials. However, a request might be forbidden for reasons unrelated to the credentials. [...]