Expand description
POST /api/v2/auth/login — a member session a browser SPA can hold.
Member auth was cookie-only: rustango_member_session is
HttpOnly; SameSite=Lax, and Lax cookies are simply not sent on
cross-site fetches. So a decoupled frontend on its own origin could
not authenticate a member at all — CORS and credentials: "include" do not help, because the browser never attaches the
cookie. Gated content was unreachable except from a same-origin page.
The token here is deliberately not a new credential format: it is
the exact same signed value the cookie carries, minted by
member_auth::encode and verified by member_auth::decode. So it
inherits the existing expiry, the tenant binding, and the rule that a
password change invalidates outstanding sessions — and it cannot
drift from the cookie path, because there is only one path.
What changes is transport: the SPA holds the value and sends
Authorization: Bearer <token> instead of relying on a cookie the
browser refuses to send.
Structs§
- Bearer
Member - A member resolved from
Authorization: Bearer <token>. - Login
Form - Credentials. Accepts JSON or form encoding, so a SPA and an HTML form can both post here.
Constants§
- LOGIN_
PATH - Where credentials are posted.
Functions§
- login
POST /api/v2/auth/login