Understanding JWT token validation in the Wacht Rust SDK
Authorization
header:
Algorithm | Type | Key Type | Description |
---|---|---|---|
HS256 | HMAC | Symmetric | HMAC with SHA-256 |
HS384 | HMAC | Symmetric | HMAC with SHA-384 |
HS512 | HMAC | Symmetric | HMAC with SHA-512 |
RS256 | RSA | Asymmetric | RSA Signature with SHA-256 |
RS384 | RSA | Asymmetric | RSA Signature with SHA-384 |
RS512 | RSA | Asymmetric | RSA Signature with SHA-512 |
ES256 | ECDSA | Asymmetric | ECDSA using P-256 and SHA-256 |
ES384 | ECDSA | Asymmetric | ECDSA using P-384 and SHA-384 |
Error | HTTP Status | Description |
---|---|---|
Missing Authorization Header | 401 | No token provided |
Invalid Token Format | 401 | Not a valid JWT |
Expired Token | 401 | Token exp claim has passed |
Invalid Signature | 401 | Token signature doesn’t match |
Unsupported Algorithm | 401 | Algorithm not in allowed list |
Invalid Public Key | 500 | Server configuration error |
X-Auth-Error: Invalid token: ExpiredSignature
WWW-Authenticate: Bearer
Token Expired
Invalid token: ExpiredSignature
Debug:Invalid Signature
Invalid token: InvalidSignature
Causes:Unsupported Algorithm
Unsupported algorithm
Solution: Ensure your token uses a supported algorithm (HS256/384/512, RS256/384/512, ES256/384)Clock Skew