Basic auth(Basic Authentication,基本认证)是一种常见的 HTTP 身份验证方式:客户端在请求头 Authorization 中携带经过 Base64 编码的 用户名:密码,服务器据此判断是否允许访问。它实现简单,但如果不配合 HTTPS,凭证容易被截获;即便使用 HTTPS,也不适合存放高价值或长期有效的密码。
/ˈbeɪsɪk ɔːθ/
I had to use basic auth to access the test server.
我必须使用 basic auth 才能访问测试服务器。
Although the API supports basic auth, the team requires HTTPS and rotates passwords regularly to reduce risk.
虽然该 API 支持 basic auth,但团队要求使用 HTTPS,并定期轮换密码以降低风险。
“Basic Authentication” 作为 HTTP 认证方案之一,最早随早期 HTTP 规范被提出并广泛实现;“basic”表示这种机制基础、简单。其核心做法是将 username:password 进行 Base64 编码后放入请求头中。后来在相关 RFC(如 RFC 7617)中得到规范化说明。