Skip to content

Rotate a customer refresh token​

POST
/auth/refresh

Rotates a customer refresh token obtained from POST /auth/login or POST /auth/register (body { refreshToken }). Answers the same AuthResponse as login (token, refreshToken, expiresIn, customer).

The presented token is consumed; the new one belongs to the same sign-in and gets a fresh 90 days, never past 365 days from the sign-in. Presenting an already-rotated token again revokes the whole sign-in (reuse detection), except within a few seconds of its rotation (a retried request), where it is only refused.

Unknown, expired, revoked or reused tokens, and a deleted or suspended customer, answer 401 { ok:false, error:'INVALID_REFRESH_TOKEN', message }. A bad body is 422. Password change, password reset and account deletion revoke every refresh token of the customer.

Auth: Public (no authentication); the refresh token is the credential.

Request Body​

application/json
JSON
{
  
"refreshToken": "string"
}

Responses​

New access token + rotated refresh token (same shape as login).

application/json
JSON
{
  
"ok": true,
  
"data": {
  
  
"token": "string",
  
  
"refreshToken": "string",
  
  
"expiresIn": 604800,
  
  
"customer": {
  
  
  
"customerId": "string",
  
  
  
"email": "user@example.com",
  
  
  
"firstName": "string",
  
  
  
"lastName": "string",
  
  
  
"phone": "string",
  
  
  
"emailVerified": true,
  
  
  
"createdAt": "2024-01-01T00:00:00Z"
  
  
}
  
}
}

Playground​

Body

Samples​

Powered by VitePress OpenAPI

Tarifs : contactez-nous — contact@marketkit.ai