Not logged in
The page needs a session and the request has none, or the session expired.
Monitor
Protect
Manage
By role
Security
Renewals
Monitoring
A 401 Unauthorized means the request has no valid authentication credentials for the resource. Despite the name, it is about authentication, not permission. Sign in, or send valid credentials, and the same request can succeed.
| 401 Unauthorized | 403 Forbidden | |
|---|---|---|
| Credentials | Missing or invalid | Valid, but not sufficient |
| Question answered | Who are you? | You are known, but not allowed |
| Retrying with credentials | Can succeed | Does not help |
| Header | Includes WWW-Authenticate | Typically none |
From MDN: 401 Unauthorized and MDN: 403 Forbidden.
GET /admin HTTP/1.1
Host: example.com
HTTP/1.1 401 Unauthorized
WWW-Authenticate: BearerThe server must send a WWW-Authenticate header naming the scheme. Here it asks for a Bearer token, which the client then sends in an Authorization header.
The page needs a session and the request has none, or the session expired.
An API call has no Authorization header, or the access token lapsed and needs refreshing.
A wrong password, a revoked key, or a Bearer token sent where Basic auth is expected.
HTTP Basic authentication is set on a folder or staging site and the browser has no valid login.
A proxy in the path drops the Authorization header before it reaches the app.
A production key used against a staging service, or the reverse.
Log in, or log out and back in. Expired sessions are the most common cause.
A broken session cookie can keep a loop of 401s. Clear cookies for that site only.
A pop-up asking for username and password is HTTP authentication. Re-enter the credentials, or ask the owner.
The header names the scheme the server expects, such as Bearer. Match it exactly.
If the token has an expiry, request a new one and retry. Check clock drift if the token looks valid.
Confirm every proxy and CDN forwards the Authorization header to your application.
It means the request lacks valid authentication credentials for the resource. The server expects you to log in or send a valid token or password. The response includes a WWW-Authenticate header naming the scheme.
A 401 means you are not authenticated, so authenticating can fix it. A 403 means the server refuses you even if it knows who you are, so logging in again changes nothing. Roles and permissions cause 403s.
Common reasons are a missing Authorization header, an expired or revoked token, the wrong scheme, or a key for a different environment. Read the WWW-Authenticate header and the response body for the expected scheme.
Neither for crawl control. Google says 401 and 403 should not be used to limit crawl rate. For rate limiting, 429 is meant for it. Use 401 only when authentication is genuinely required.
When a 401 response carries a WWW-Authenticate header for Basic authentication, the browser asks for a username and password. This is common on staging sites and protected folders. Cancel it and the page shows the 401 content instead.
Aepto monitors expiry, DNS, SSL and uptime for every domain you own and alerts you when something changes. Free for 3 domains.