Re: x402

On Mon, Aug 31, 2026 at 07:30:03AM +0200, Martin Thomson wrote:
> However, it's hard to disentangle 401 from this.  A decision to deny
> access on the basis of (a lack of) payment is still fundamentally an
> authorization decision.

401 and 402 are in many ways very similar in that both ask the user-
agent to do demonstrate something such as an authenticated identity,
authorization grant token, or payment, and payment is a form of
authorization token and it can even be a form of authentication.  And
both 401 and 402 can yield 403 to terminate the exchange.

One could define a 401-driven HTTP auth method for payment.

So why should payment required get its own status code?  Qualitatively
auth and payment seem just different enough to justify the difference.
Maybe there is a user-agent complexity argument that 402 can immediately
trigger a wallet protocol while 401 requires inspecting WWW-Authenticate
to see if a wallet protocol is requested, and also if multiple auth and
payment options are given (login, or pay), then what?  But then, why
isn't "login or pay" an option?  Separating 401 and 402 makes that not
an option.

Then again, the web doesn't use 401.  The web uses password forms or 3xx
OAuth.  The same thing could end up being true of 402; that outcome even
seems very likely to me.

I do wish that 3xx redirects for auth came with a header to say as much.
Ditto 3xx for payment.

Nico
-- 

Received on Tuesday, 1 September 2026 15:39:07 UTC