Refresh
POST/auth/refresh
Rotate a refresh token and issue a new access token.
Validates the refresh token against the DB, atomically revokes it, and returns a new access token and a new refresh token. Within 30 seconds of that rotation, the previous refresh token gets back the same new refresh token, as long as it has not been used yet: a client that never received the answer is not signed out. Replayed later, or after the new token was used, it revokes its whole session (reuse detection, RFC 9700 §4.14.2).
The web session (Batch A2). With X-Scrift-Web-Session the
refresh token is read from, and written back to, the HttpOnly
__Host-scrift-web-session cookie, and the body carries none. The
header must come with an Origin on the CORS allow-list, or the
request is refused with 403 cross_site_request_refused (CSRF).
There is no other way to present a refresh token: the pre-cookie body
contract was retired (#276), so a request without the header and the
cookie is refused with 401 invalid_token.
The new token's idle end is SCRIFT_WEB_SESSION_IDLE_DAYS away but
never past the session's absolute end, which rotation never moves.
Rate limit (SCRIFT-73): 60 requests/minute keyed by client IP. Per-IP (not per-user) is the correct key for a token- exchange endpoint - before the token is decoded the server does not know which user is calling, so a per-user key would be unreachable. Matches OWASP ASVS V11.1.4 and the Stripe / Auth0 / Keycloak token-endpoint pattern.
Responses
- 200
Successful Response