/gate/refreshRefresh Session
Exchanges a refresh token for a new Gate access JWT and a new refresh token, extending the end user's session under the project's session policy.
Each refresh replaces the refresh token: store the returned refreshToken and refresh one call at a time per session.
Presenting a refresh token that was already exchanged revokes the session and returns K9O_SESSION_EXPIRED (401) with context.reason replay; the session's newer refresh token is refused from then on.
| projectSlug * | path | The project's slug: the path segment after It is unique within the org. |
| refreshToken * | string | The refresh token from the sign-in or from the last refresh. Each one works once. |
| HTTP | K9O Code | Description |
|---|---|---|
| 200 | Success | |
| 401 | K9O_INVALID_CREDENTIALS | The refresh token is unknown, or the end user is locked. |
| 401 | K9O_SESSION_EXPIRED | The session has ended and a fresh sign-in is required. `context.reason` says why: `inactive`, `max_length`, `revoked`, or `replay` (a refresh token that was already exchanged was presented again, and the session is now revoked). |
| data * | object | A new access token and a new refresh token for the same session. The refresh token you sent no longer works. |
| accessToken * | string | A signed JWT that authenticates the end user to this project's API. Send it as Its subject ( It lives for the project's end-user access token lifetime: 30 minutes by default, settable from 5 to 60 minutes. It cannot be revoked early: signing out or revoking sessions stops the next refresh, but a token already issued stays valid until |
| refreshToken * | string | An opaque secret (43 base64url characters) that gets a new access token from Store it securely and never send it anywhere else. It is single use: every refresh returns a new refresh token, and sending the one it replaced a second time ends the whole session. It stops working when the session ends: on sign-out, a password reset, a revoke-all, or when the project's session limits are reached (by default 30 days without a refresh, or 90 days after sign-in, whichever comes first). |
| expiresAt * | string <date-time> | When Refresh before this time to keep the end user signed in. |
| meta * | any | Request metadata: cost, timing and the request and trace ids. |
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.gate.refreshToken({
refreshToken: 'EXAMPLE-refresh-token-not-a-real-secret-000'
})Showing example in TypeScript
{
"refreshToken": "EXAMPLE-refresh-token-not-a-real-secret-000"
}{
"data": {
"accessToken": "string",
"refreshToken": "string",
"expiresAt": "string"
}
}