4xx Client error

HTTP 401 Unauthorized

Authentication is required or failed. The response should include a WWW-Authenticate header.

401 Unauthorized means the request has no valid credentials. Despite the name, it is about authentication: the server does not know who you are. It must include a WWW-Authenticate header saying how to authenticate.

HTTP/1.1 401 Unauthorized

Common causes

  • No Authorization header, or a missing API key.
  • An expired or revoked token, or a JWT whose signature or audience does not match.
  • Wrong username and password for basic auth.

How to fix it

  • Send credentials in the scheme named by WWW-Authenticate, such as Authorization: Bearer <token>.
  • Refresh the access token if it expired, then retry once.
  • Decode the JWT to check its exp, aud and iss claims.

Related status codes

Other status codes

1xx Informational

2xx Success

3xx Redirection

5xx Server error

Search all HTTP status codes