“未验证电子邮件”的HTTP状态 [英] HTTP status for "email not verified"

查看:380
本文介绍了“未验证电子邮件”的HTTP状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了所有HTTP状态代码的列表。
但对我来说,似乎没有未经验证的电子邮件(用于身份验证/授权)的代码。
你曾经遇到过同样的问题吗?您使用了什么HTTP状态代码?

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 same "problem"? What HTTP status code did you use?

我想它应该是以4开头的代码,因为它是客户端错误。

I guess it should be a code starting with a 4 as it's a "client error".

推荐答案

4xx 类状态代码适用于客户端似乎有错误的情况:

The 4xx class of status code is intended for situations in which the client seems to have erred:


6.5。客户端错误4xx

4xx (客户端错误)类状态代码表示客户
似乎有错误。除了在响应 HEAD 请求时,
服务器应该发送一个包含
错误情况说明的表示,以及它是临时的还是永久
条件。这些状态代码适用于任何请求方法。
用户代理应该向用户显示任何包含的表示。

The 4xx (Client Error) class of status code indicates that the client seems to have erred. Except when responding to a HEAD 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.

对于身份验证授权 401 403 分别是要使用的正确状态代码。无论状态代码如何,您都应该始终在响应有效负载中描述错误原因。

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.

将此状态代码用于HTTP 身份验证的问题,即无效凭据。

Use this status code for problems with HTTP authentication, that is, invalid credentials.


3.1。 401未经授权

401 (未经授权)状态代码表示该请求未应用
,因为它缺少目标资源
的有效身份验证凭据
。生成 401 响应的服务器必须发送包含至少一个$ b $的
a WWW-Authenticate 标头字段b挑战适用于目标资源。

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 a 401 response MUST send a WWW-Authenticate header field containing at least one challenge applicable to the target resource.

如果请求包含身份验证凭据,则 401
响应表示已拒绝授予这些
凭证
的授权。用户代理可以使用新的或
替换授权标头字段重复请求。如果 401
响应包含与先前响应相同的质询,并且
用户代理已经尝试过至少一次身份验证,那么
用户代理应该给
用户提供随附的表示,因为它通常包含相关的诊断信息。

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 replaced Authorization header field. If the 401 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 禁止



将此状态代码用于授权的问题,即凭据是有效,但不足以授予访问权限。

403 Forbidden

Use this status code for problems with authorization, that is, the credentials are valid but they are insufficient to grant access.


6.5.3。 403禁止

403 (禁止)状态代码表示服务器理解
请求但拒绝授权
。希望
的服务器公开请求被禁止的原因可以在响应有效负载中描述
的原因(如果有的话)。

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. [...]

这篇关于“未验证电子邮件”的HTTP状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆