Skip to main content

Refresh Tokens

POST/auth/refresh
Get a fresh set of tokens using your refresh token. When your access token expires, use this endpoint instead of asking users to log in again. You'll get a new access token and a new refresh token-make sure to save both. This keeps users signed in seamlessly while maintaining security with short-lived access tokens.

When to use this

  • Keeping users logged in without interruption
  • Implementing automatic token refresh in your app
  • Handling expired tokens gracefully in background processes

Request Body

Response

Token refreshed successfully

Notes

ℹ️Both tokens are rotated on each refresh. Always store the new refresh token for the next refresh cycle.
💡Refresh proactively-check token expiry and refresh a minute or two before it expires to avoid failed requests.
Code Samples

Refresh using the TypeScript SDK:

import { BackstageClient } from '@ticketlayer/backstage';

const client = new BackstageClient({
organisationSlug: 'your-org',
});

// Refresh access token
const { accessToken, refreshToken } = await client.auth.refresh({
refreshToken: 'your-refresh-token',
});

console.log('Tokens refreshed successfully');

Try It

Related