OAuth code delivery¶
code_delivery=page lets a client that can accept a pasted code ask the
authorization step to show a code instead of redirecting the browser. It is
for a client that runs on a computer the user's browser cannot reach. Governing
rule: cor:aut:030:01, "A code-entry completion for a host with no browser".
For the steps a person follows, see
Finish a login on a host with no browser.
The problem it solves¶
A client that signs in through /oauth/authorize usually registers a loopback
redirect address, such as http://localhost:64061/callback or
http://127.0.0.1:8765/callback, and listens on it. After consent the browser is
sent there. When the client runs on another computer (over SSH, in a container,
on a server), the browser cannot reach that listener and shows "This site can't
be reached". The address bar still holds the authorization code.
The parameter¶
GET /oauth/authorize?response_type=code&client_id=…&redirect_uri=…&code_challenge=…
&code_challenge_method=S256&resource=…&state=…&code_delivery=page
code_delivery |
What happens after consent |
|---|---|
| absent or empty | The browser is redirected to redirect_uri with code and state, as before. |
page |
No redirect. The page shows a code <handle>.<secret> (16 and 64 hex characters) for the user to type into the client. |
| anything else, or repeated | An invalid_request redirect, and no code is issued. |
The server never decides this for the client. It does not probe the loopback address, read the user agent or guess from timing. The code page is shown only when the request asks for it. A client that cannot accept a pasted code should not ask, because the user would have nowhere to type it. Nothing on the server enforces this.
What does not change¶
- The code is the ordinary authorization grant. It is single-use, lasts about 10
minutes, is hashed at rest and is useless without the client's PKCE verifier.
Redeem it at
/oauth/tokenexactly like a redirected code, with the sameclient_id,redirect_uri,resourceandcode_verifier. - A correct code redeemed with a wrong verifier, client, redirect address or resource ends the code at once. A client must redeem with the values it sent.
- Sign-in and consent are the same. The code is shown only after consent.
- The consented form's signature covers the choice, so adding or dropping the parameter after consent is refused.
Refusals and limits¶
- Wrong, expired and used codes all get one
400withinvalid_grantand the description "code is unknown". - A pending login allows 5 wrong entries and is then dead. The user starts a new login.
- The existing per-source rate limit applies to entry as well.
- Denying on the other device still redirects the browser to the client's loopback address.
The consent page's loopback line¶
When approval will redirect to a loopback address (host localhost, an address in
127.0.0.0/8, or [::1], over http or https) and the request did not ask for the
code page, the consent page shows one line under "Returns to:". It says what to do
if the next page cannot be reached: copy the full address from the address bar into
the client if it asks for one, or, for the Hadron CLI, use
hadron auth login --no-browser. The line is chosen from the registered redirect
address alone. The redirect, the code and its lifetime are unchanged.
Clients¶
| Client | Redirect it registers | Sends code_delivery=page? |
What a user on a host with no browser does |
|---|---|---|---|
Hadron CLI (hadron auth login) |
http://127.0.0.1:<random port>/callback |
Yes, with --no-browser, and by itself when no browser can be opened. |
Run hadron auth login --no-browser, open the printed address on any device, type the code shown back into the terminal. |
Claude Code (remote MCP server, claude mcp add --transport http …) |
http://localhost:<random port>/callback |
No. Its documented OAuth settings are the metadata URL, scopes, client id and callback port; it adds no authorize parameters. | Paste the full callback URL from the browser's address bar into Claude Code's prompt, or run claude mcp login <name> (or add --no-browser) in an interactive terminal, which prints the authorization address and asks for that URL. |
The Claude Code row follows its MCP documentation, checked on 2026-11-30; re-check it when Claude Code changes its sign-in.