• 状态
  • 响应示例
  • 规范
  • 浏览器兼容性
    • Legend
  • 相关内容
  • 文档标签和贡献者

    状态码 401 Unauthorized 代表客户端错误,指的是由于缺乏目标资源要求的身份验证凭证,发送的请求未得到满足。

    这个状态码会与 WWW-Authenticate 首部一起发送,其中包含有如何进行验证的信息。

    这个状态类似于 403, 但是在该情况下,依然可以进行身份验证。

    状态

    1. 401 Unauthorized

    响应示例

    1. HTTP/1.1 401 Unauthorized
    2. Date: Wed, 21 Oct 2015 07:28:00 GMT
    3. WWW-Authenticate: Basic realm="Access to staging site"

    规范

    SpecificationTitle
    RFC 7235, section 3.1: 401 UnauthorizedHTTP/1.1: Authentication

    浏览器兼容性

    The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.

    Update compatibility data on GitHub

    DesktopMobile
    ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
    401ChromeFull support YesEdgeFull support YesFirefoxFull support YesIEFull support YesOperaFull support YesSafariFull support YesWebView AndroidFull support YesChrome AndroidFull support YesEdge MobileFull support YesFirefox AndroidFull support YesOpera AndroidFull support YesSafari iOSFull support YesSamsung Internet AndroidFull support Yes

    Legend

    • Full support
    • Full support

    相关内容

    • HTTP authentication
    • WWW-Authenticate
    • Authorization
    • Proxy-Authorization
    • Proxy-Authenticate
    • 403, 407

    文档标签和贡献者

    标签:

    • 客户端错误
    • 状态码
    • 身份验证
    • 身份验证凭证

    此页面的贡献者:mdnwebdocs-bot, WayneCui

    最后编辑者:mdnwebdocs-bot,