Docs › Secure › Tokens › Refresh Tokens
Refresh Token Rotation
Refresh token rotation issues a new refresh token every time an application exchanges one for an access token. The previous token is spent the moment it is used.
If a previously used refresh token is presented again, the authorization server treats it as a replay and invalidates the whole token family, so every session using it must sign in again.
const tokens = await auth.refresh(refreshToken);
// the old refresh token is now spent
await session.update(id, {
refreshToken: tokens.refreshToken,
});