POST /api/auth/renew
Renew an active session by refreshing the session cookie with a newissuedAt timestamp. This endpoint resets the 5-minute expiry window, allowing users to stay signed in without re-authenticating.
This endpoint must be called with credentials (the existing session cookie) and will only succeed if the session is still valid.
Request
Headers
Must include the
crocante_session cookie from an active sessionBody
No request body required. The session token is read from the cookie.Response
true if the session was successfully renewedSuccess Response
Set-Cookie header with the renewed session cookie containing the same token but a fresh issuedAt timestamp.
Error Responses
401 Unauthorized - Session is invalid or expiredUsage
This endpoint is typically called automatically by the client before the session expires to maintain an active session.Behavior
- Token Preservation: The same authentication token is kept; only the
issuedAttimestamp is updated - Expiry Reset: The 5-minute countdown starts fresh from the renewal time
- Cookie Update: A new
Set-Cookieheader is returned with the updated session - Idempotent: Can be called multiple times while the session is valid
Security
- HTTP-only cookie prevents JavaScript access
- Secure flag enforced in production (HTTPS only)
- SameSite=Strict prevents CSRF attacks
- Session payload encrypted with AES-256-GCM
Common Use Cases
Automatic Renewal
Keep users logged in by automatically renewing before expiry:Manual Renewal
Allow users to manually extend their session:Related Endpoints
- Login - Authenticate and create a new session
- Logout - End the current session
- Session Status - Check session validity and expiry time
