Skip to content
v3.0.1 — MCP OAuth, organizations, passkeys, SSR adaptersChangelog
Convex Auth
Esc
↑↓navigate↵open⌘Jpreview

Rotate a refresh token into a new session pair

Exchanges a refreshToken for a new access/refresh pair and writes session cookies. Rotation is one-time with a ~15 s convergence grace for parallel refreshes; replay outside the window returns invalid_refresh_token. CSRF-enforced: cross-site POSTs return 403.

POST/api/auth/update-session
Request body
requiredapplication/json
refreshTokenstringrequired
Responses
200

New pair issued; Set-Cookie headers are private, no-store.

successbooleanrequired
Allowed:true
tokenstring

Access token (also delivered via Set-Cookie in cookie mode).

refreshTokenstring

Rotation token for /api/auth/update-session.

redirectboolean

Whether url should be navigated to.

urlstring

Validated landing URL.

userUser
Show properties
idstring
emailstring<email>
namestring
imagestring
emailVerifiedboolean
400

Invalid body or an untrusted redirect parameter.

successbooleanrequired
Allowed:false
reasonstringrequired
401

Refresh token invalid, expired, or already rotated.

successbooleanrequired
Allowed:false
reasonstringrequired
403

Cross-site request rejected by CSRF validation (Fetch Metadata / Origin). Same-origin and explicitly trusted origins are unaffected.

successbooleanrequired
Allowed:false
reasonstringrequired
Try it
Server
Bodyapplication/json
Request
curl -X POST 'https://your-deployment.convex.site/api/auth/update-session' \
  -H 'Content-Type: application/json' \
  -d '{
  "refreshToken": "string"
}'
Response
{
  "success": true,
  "token": "string",
  "refreshToken": "string",
  "redirect": true,
  "url": "string",
  "user": {
    "id": "string",
    "email": "user@example.com",
    "name": "string",
    "image": "string",
    "emailVerified": true
  }
}