Skip to content
HTTP

Authentication

Basic, Bearer, and challenge responses.

#auth#basic#bearer

Code

http
# Basic Auth
GET /secure HTTP/1.1
Host: example.com
Authorization: Basic dXNlcjpwYXNz

---

# Bearer Token (JWT)
GET /api/me HTTP/1.1
Host: example.com
Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.payload.signature

---

# Server challenge
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer realm="api", error="invalid_token"