Skip to main content

Module par

Module par 

Source
Expand description

Pushed Authorization Requests (RFC 9126).

POST /oauth/par lets the client push the authorization request parameters out-of-band, then navigate the browser to /oauth/authorize?request_uri=... with a short, opaque reference. Required by atproto OAuth; also avoids URL length and referer-leakage problems with long inline parameters.

Flow:

  1. Client POSTs the same parameters it would pass to GET /oauth/authorize.
  2. Server validates them up front (same checks the GET handler does: response_type, PKCE method, client metadata resolution, redirect_uri).
  3. On success, the server generates a URN of the form urn:ietf:params:oauth:request_uri:<random-id> (RFC 9126 §2.2, RFC-standard form used by atproto OAuth clients) and stores the validated AuthorizeParams snapshot keyed by it. 60s TTL.
  4. Returns { "request_uri": "...", "expires_in": 60 } with HTTP 201.

The /oauth/authorize GET handler resolves request_uri by consuming the entry (single-use per spec) and proceeding as if the params had been inline.

Structs§

ParForm
PAR form body. Same shape as AuthorizeParams, but accepted as a form POST.
ParResponse
PAR success response body (RFC 9126 §2.2).

Constants§

PAR_TTL_SECS
PAR request lifetime. RFC 9126 recommends short-lived (e.g. <= 60s).

Functions§

push_authorization_request
POST /oauth/par