WWW-Authenticate 是一个 HTTP 响应头(response header),服务器在返回 401 Unauthorized(未授权) 时用它来告知客户端:需要使用哪种认证方案(如 Basic、Bearer、Digest),以及相关参数(如 realm、scope、charset 等)。常见于受保护资源的访问与 API 鉴权流程中。
/ˌdʌbəl.juː ˌdʌbəl.juː ˌdʌbəl.juː ɔːˈθentɪkeɪt/
The server replied with a 401 and a WWW-Authenticate header.
服务器返回了 401,并带有 WWW-Authenticate 响应头。
If the API returns WWW-Authenticate: Bearer realm="example", error="invalid_token", the client should refresh the token and retry the request.
如果 API 返回 WWW-Authenticate: Bearer realm="example", error="invalid_token",客户端应刷新令牌并重试请求。
该术语来自万维网早期的 HTTP 规范命名方式:WWW- 表示与 Web(World Wide Web)相关的头字段,Authenticate 源自动词 authenticate(“验证真伪/确认身份”),其词根可追溯到表示“权威、真实”的古希腊语来源,经由拉丁语、法语进入英语。在 HTTP 中,它专指“要求并说明认证方式”的提示信息。