Przemek Lewandowski
@haxoza
2. Response: HTTP 401 Unauthorized
WWW-Authenticate: Basic realm="Hello there!"
1. Request: GET /invoices/
3. Request: GET /invoices/
Authorization: Basic QWxhZGRpbjpPcGVuU2VzYW1l
4. Response: HTTP 200 OK
header_value = base64.encode("username:password")
2. Response: HTTP 401 Unauthorized
WWW-Authenticate: Token
1. Request: GET /invoices/
5. Request: GET /invoices/
Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b
6. Response: HTTP 200 OK
4. Response: 200 OK
{"token" : "9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b"}
3. Request: POST /obtain-auth-token/
{"username": "john", "password": "secretpass"}
2. Response: HTTP 401 Unauthorized
WWW-Authenticate: Digest nonce="123456"
1. Request: GET /invoices/
4. Response: HTTP 200 OK
3. Request: GET /invoices/
Authorization: Digest username="john" realm="xyz"
token=MD5(nonce, username, realm, URI, password))
2. Response: HTTP 401 Unauthorized
WWW-Authenticate: JWT realm="api"
1. Request: GET /invoices/
6. Response: HTTP 200 OK
5. Request: GET /invoices/
Authorization: JWT eyJhbGciOiAiSFMyNTYiLCAidHlwIj
4. Response: 200 OK
{"token" : "eyJhbGciOiAiSFMyNTYiLCAidHlwIj"}
3. Request: POST /obtain-auth-token/
{"username": "john", "password": "secretpass"}
{
"alg": "HS256",
"typ": "JWT"
}
{
"sub": "1234567890",
"name": "John Doe",
"admin": true
}
HMACSHA256(
base64UrlEncode(header) + "." +
base64UrlEncode(payload),
secret)
Header
Payload
Signature