part 1Foundations: before OAuth·lesson 1.4 of 5·3 min read
HTTP for auth: 401, 403 and WWW-Authenticate
These are the HTTP building blocks that servers and clients use to talk about authentication: the Authorization header with the Bearer scheme, the difference between 401 Unauthorized and 403 Forbidden, and the WWW-Authenticate header that starts the OAuth flow in MCP authorization.
In this lesson
Read the Authorization header and the Bearer scheme.
Tell a 401 from a 403 without hesitation.
Interpret WWW-Authenticate, the starting point of the OAuth flow in MCP.
The Authorization header
The client presents its credential in Authorization: <scheme> <credential>. The scheme says how to interpret what follows: Basic (user:password in Base64), Bearer (a token: "whoever bears it, uses it", RFC 6750), and so on. In MCP with OAuth it is always Bearer, and always in the header, never in the URL.
Bearer is the "bearer token" scheme: whoever holds it can use it. That is exactly why it must never go in the URL.
401 vs. 403: the difference you must be crystal clear about
Code
Name
Actual meaning
What the client should do
401
Unauthorized
"I don't know who you are": the token is missing, invalid, expired or meant for another audience. (The name is historical; it is really an authentication problem.)
Get a (new) token and retry
403
Forbidden
"I know who you are, but you can't do this": the token is valid but lacks sufficient permission.
Ask for more permissions (scopes) or give up
WWW-Authenticate: the server explains how to authenticate
When a server responds 401, it can (and in MCP it usually does) include the WWW-Authenticate header, which tells the client which scheme to use and gives it hints. It is the piece that turns a plain "no" into a "no, but go here for your token".
Since 2025-06-18 the MCP server must include the URL of its protected resource metadata (RFC 9728). The client reads it and learns which authorization server to go to.
It can also indicate the scope the client should request. Including the header is no longer strictly required: if it is missing, the client tries the .well-known paths (see lesson 3.4).