See the 401 vs 403 difference as a request sequence. 'Not logged in' (401) vs 'logged in but not allowed' (403) shown with the actual headers involved.
Scenario
Requests
2
Current step 6/6
403 = authenticated but forbidden. Retrying gives the same answer — you need a different account or permission. Some servers even masquerade as 404 to hide a resource's existence.
Arrow color = status class. The key redirect pair: 301 is 'permanent', 307 'keeps the method'. Notice how cheap the second request is when the cache validates (304).
All status codes
1xx Informational
2xx Success
3xx Redirection
4xx Client error
5xx Server error
401 and 403 encode the authentication/authorization split. 401 means 'I don't know who you are' — not logged in, missing token, or expired credentials. The server hints at what it wants with the WWW-Authenticate header. Despite the name 'Unauthorized', it really means 'unauthenticated', which is why APIs use it as the 'log in first' signal.
403 means 'I know exactly who you are — and you're not allowed'. A normal user hitting an admin page, someone reading another user's resource. Re-authenticating won't help; you need different permissions or a different account.
The distinction leaks security information. 401 says 'you could get in with credentials'; 403 confirms 'it exists but not for you'. To hide that a sensitive resource even exists, some servers deliberately answer 404 instead — GitHub's private repos do exactly this. HTTP Status Playground