Refresh token rotation
Refresh token rotation is the OAuth practice of issuing a fresh refresh token every time an access token is refreshed, invalidating the previous one. The pattern detects token theft: if both old and new are presented, the server treats it as compromise and revokes everything.
Why it matters
OAuth refresh tokens are long-lived credentials. If a refresh token leaks, an attacker can keep generating fresh access tokens indefinitely. Rotation is the defense.
The pattern: every time the agent calls /oauth/token with grant_type=refresh_token to get a new access token, the server issues both a new access token AND a new refresh token. The old refresh token is invalidated. If the agent ever tries to use the old refresh token again (because it was leaked, the server saw both old and new presented), the server treats it as compromise and revokes the entire session.
This works because legitimate clients always use the most recent refresh token. An attacker who stole an old token would either get a stale-token error (revealing the leak) or, if they intercepted recently, would use the same refresh token the legitimate client also uses, triggering detection.
For AI agents managing OAuth tokens for many users and many services, rotation is the baseline production hygiene. Most modern OAuth providers (Google, Microsoft, GitHub) require it.
How Ajeris handles this
Ajeris implements refresh token rotation for every OAuth integration. When the agent refreshes an access token, both the new access token and the new refresh token are persisted encrypted at rest. The old refresh token is discarded. If a stale token is ever presented (theft scenario), the upstream OAuth provider revokes the session and the agent surfaces a re-auth prompt to the user.
The handling is invisible to the user; tokens just keep working until the user revokes access at the source.