401 means the site needs you to sign in, or your sign-in has expired. Visitors: sign out and back in, clear the site's cookies, and check the URL. Developers: send a valid Authorization header or refresh the token.

The short explanation

A 401 response means the page requires authentication and the request didn't include valid credentials: you're not signed in, your session expired, or (for APIs) the token is missing or wrong.

Unlike 403, signing in with the right account normally fixes a 401.

Symptoms

  • A page redirects to login or shows “401 Unauthorized.”
  • An API that worked earlier now returns 401.
  • It happens after leaving a tab open for hours.

Why it happens

  • The login session or access token has expired.
  • The Authorization header is missing, malformed, or using the wrong scheme.
  • The request was sent to the wrong realm or with the wrong authentication scheme (for example Basic vs Bearer).
  • The device clock is wrong, so time-based token validation fails.

Try these fixes

  1. Sign out and back in to get a fresh session; clear stale auth cookies for the site.
  2. For APIs, confirm the Authorization header is present, correctly formatted (e.g. “Bearer <token>”), and the token is not expired.
  3. Check that the credentials are valid and current: token not expired, correct Authorization header format, and the system clock set automatically (token validity depends on time). Lacking permission with valid credentials gives 403 instead.

Command

curl -i -H "Authorization: Bearer <TOKEN>" "https://api.example.com/resource"

A 200 here with a fresh token confirms the credentials path; a 401 means the token or its formatting is the problem.

How to confirm the fix: The resource loads or the API returns 200 with a renewed token or session.

Avoiding it in future

Implement token refresh before expiry in clients, and keep device clocks synced automatically.