Skip to main content

Portal auth

Generated from apiome-rest/openapi.yaml (API version 1.719.0) — do not edit by hand. How to authenticate is on the REST API reference.

Tag: portal-auth · 4 operations

POST /v1/portal/{tenant_slug}/auth/exchange​

Exchange a sign-in link for a reader session

Trade a magic-link token for a reader session. The token is burned: a second exchange is 410 portal-token-used, an exchange after 15 minutes 410 portal-token-expired, and an unknown or malformed token 400 portal-token-invalid.

The session token is returned once. It is bound to this tenant and is sent back as Authorization: Reader <token>; it is accepted only by the portal-auth and browse routes. The request's User-Agent is reduced to a browser family before it is stored.

No authentication — the token is the credential.

Operation id: exchange_magic_link_v1_portal__tenant_slug__auth_exchange_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
user-agentheaderstring or nullnoHeader parameter: User Agent.

Request body (required)

Request body for exchange a sign-in link for a reader session.

Responses

StatusDescriptionBody
200Successful response for exchange a sign-in link for a reader session.application/json ReaderSessionGrant
422Validation Errorapplication/json HTTPValidationError

POST /v1/portal/{tenant_slug}/auth/magic-link​

Send a reader sign-in link

Mail a one-time sign-in link for the tenant's Browse portal. The link expires in 15 minutes and works once.

An address with no account gets one (a password-less user) and an invited reader membership, when the installation sign-up policy allows new accounts; a second request for the same address reuses both.

Always 202 for a well-formed request: the response never says whether a link was sent, so it cannot be used to discover accounts. 422 for a malformed address or a return_to that is not a path inside Browse. Budgeted per client address and per email address (429 portal-rate-limited with Retry-After).

No authentication.

Operation id: request_magic_link_v1_portal__tenant_slug__auth_magic_link_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.

Request body (required)

Request body for send a reader sign-in link.

Responses

StatusDescriptionBody
202Successful response for send a reader sign-in link.application/json MagicLinkAccepted
422Validation Errorapplication/json HTTPValidationError

GET /v1/portal/{tenant_slug}/auth/me​

The signed-in reader

The reader behind Authorization: Reader <token>: their address, the tenant the session is bound to, and when the session ends.

401 portal-session-invalid for a missing, expired or revoked session, a session for another tenant, or a reader whose membership was revoked.

Operation id: read_me_v1_portal__tenant_slug__auth_me_get

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).

Responses

StatusDescriptionBody
200Successful response for the signed-in reader.application/json ReaderProfile
422Validation Errorapplication/json HTTPValidationError

POST /v1/portal/{tenant_slug}/auth/sign-out​

Sign a reader out

Revoke the reader session in Authorization: Reader <token>. The session is refused from the next request on. Idempotent: an unknown or already revoked session is also 204.

Operation id: sign_out_v1_portal__tenant_slug__auth_sign_out_post

Parameters

NameInTypeRequiredDescription
tenant_slugpathstringyesURL-safe tenant slug that scopes the request.
authorizationheaderstring or nullnoJWT bearer token for authenticated access (Authorization: Bearer <token>).

Responses

StatusDescriptionBody
204Successful response for sign a reader out.—
422Validation Errorapplication/json HTTPValidationError

Schemas used​

HTTPValidationError​

Validation error response emitted when request data fails schema checks.

PropertyTypeRequiredDescription
detailarray of ValidationErrornoDetail.

MagicLinkAccepted​

The answer to every well-formed magic-link request.

PropertyTypeRequiredDescription
acceptedtruenoAlways true. Whether a link was actually sent is never revealed, so the answer cannot be used to learn who has an account.
expires_in_minutesintegernoHow long a link is valid once it arrives.

MagicLinkRequest​

Ask for a sign-in link.

Attributes: email: The reader's address. return_to: A Browse path to land on after signing in.

PropertyTypeRequiredDescription
emailstringyesThe reader's email address.
return_tostring or nullnoA path inside Browse to return to after signing in (for example /tenant/acme).

ReaderProfile​

The signed-in reader.

PropertyTypeRequiredDescription
user_idstringyesUser ID.
emailstringyesEmail.
namestring or nullnoHuman-readable name.
tenant_slugstringyesURL-safe tenant slug used in path parameters.
tenant_namestring or nullnoTenant Name.
membership_statusenum "invited", "active", "revoked"yesMembership Status.
session_expires_atstring (date-time)yesWhen the current session ends.

ReaderSessionGrant​

A new reader session.

The token is returned once. Browse stores it in an HttpOnly cookie and forwards it as Authorization: Reader <token>; it is never shown to the reader.

PropertyTypeRequiredDescription
session_tokenstringyesThe opaque session token. Returned once; store it securely.
expires_atstring (date-time)yesExpires At timestamp (ISO 8601).
return_tostring or nullnoWhere the magic link asked to land.
readerReaderProfileyesReader.

TokenExchange​

Exchange a magic-link token for a reader session.

PropertyTypeRequiredDescription
tokenstringyesThe token from the magic link.