Join our Newsletter — 33% off our NHI Course
Home› Guides› OAuth Refresh Token Rotation and Expiry Guide: Stopping…
Guide Authorisation

OAuth Refresh Token Rotation and Expiry Guide: Stopping Long-Lived Token Persistence

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 27 October 2026 13 min read
On this page

A refresh token is a standing credential that can mint new access tokens for months or years without the user, MFA or the original device ever being involved again. That makes it the natural persistence mechanism after a breach: steal one refresh token from an integration vendor, a developer laptop or a browser, and access survives password resets and access token expiry. RFC 9700, the OAuth 2.0 Security Best Current Practice, sets the baseline: refresh tokens for public clients must be sender-constrained or rotated, and they should expire when unused. This guide explains rotation and reuse detection, absolute and idle expiry, sender-constraining, the IETF draft that lets servers tell clients when tokens expire, and how real platforms behave. It is for identity engineers, SaaS administrators and anyone who owns OAuth integrations.

Key takeaways

  • Every refresh token needs an absolute end date. Sliding or "unlimited" lifetimes turn one theft into indefinite access; OWASP ASVS 5.0 V10.4.8 requires an absolute expiration even when sliding expiry is used.
  • Rotation only helps with reuse detection. RFC 9700 rotation means the old token is invalidated and, if it is ever presented again, the server revokes the active token too.
  • Sender-constraining beats rotation where you can use it. DPoP (RFC 9449) or mTLS (RFC 8705) makes a stolen refresh token useless without the client's private key.
  • Password resets do not reliably kill refresh tokens. Platform behaviour differs by token type and event; leaver and incident runbooks must revoke grants explicitly.
  • Integration refresh tokens are the highest-risk population. They are held by third parties, rarely expire and are invisible to the user who granted them.

Why refresh tokens are the persistence vector

Access tokens are deliberately short-lived; refresh tokens exist so that the short life does not inconvenience anyone. The trade-off is that the refresh token carries the full authority of the grant for as long as the authorisation server lets it live. RFC 9700 section 4.14 requires authorisation servers to decide whether to issue refresh tokens at all based on a risk assessment, and, where they do, to bind them to the scope and resource servers the resource owner consented to.

Two recent SaaS incidents show the pattern. In the Gainsight Salesforce breach the attacker held 285 Salesforce refresh tokens issued to a connected app, some created as far back as 2017 and still valid until revoked; Gainsight's own root-cause finding was that the tokens were allowed to live too long. In the Salesloft Drift breach stolen access and refresh tokens for the Drift integration were used to bulk-export Salesforce data until all of the application's tokens were revoked. Neither needed a user password. In ATT&CK terms this is T1528 Steal Application Access Token followed by T1550.001 Application Access Token. See the Token Lifetime Policy Design Guide for setting lifetimes across token types; this page goes deep on refresh tokens.

Rotation and reuse detection

RFC 9700 describes refresh token rotation precisely: every refresh response issues a new refresh token and invalidates the previous one, while the server keeps the relationship between them (the token "family"). If an invalidated token is presented again, the server cannot tell whether the attacker or the legitimate client sent it, so it revokes the active refresh token and the client must obtain a new authorisation grant.

  1. The client authenticates the user and receives refresh token RT1.
  2. The client refreshes with RT1 and receives RT2; RT1 is now invalid but recorded as part of the family.
  3. An attacker who stole RT1 presents it. The server sees a reused token and revokes RT2 and the whole family.
  4. Both parties lose access; the legitimate user signs in again, the attacker cannot.

The weakness is the order of events. If the attacker refreshes first, the legitimate client's next refresh is the one flagged, which still triggers revocation, but the attacker had access in between. If the legitimate client stops using the app, the attacker's chain may never be challenged. Rotation is therefore a detection mechanism, and its value depends on the client refreshing regularly and on someone watching reuse events.

Grace periods

Clients on unreliable networks can lose the response containing the new token and retry with the old one. Some products allow a short grace period: Okta, for example, documents a default of 30 seconds, configurable from 0 to 60, during which the previous token remains valid. Keep it as short as your clients tolerate; every second is a window in which a stolen token can be refreshed without triggering reuse detection.

Expiry: absolute, idle and tied to the session

ControlWhat it doesSourceSuggested starting point
Idle (inactivity) expiryToken dies if not used for a periodRFC 9700 4.14: refresh tokens SHOULD expire after a period of client inactivity7 to 30 days for user apps; shorter for admin scopes
Absolute expiryToken family dies at a fixed time after authentication regardless of useASVS V10.4.8; RFC 10017 for browser clients: maximum lifetime, not extended by rotationBrowser apps: the user session (hours); mobile: 30 to 90 days; integrations: 90 to 365 days with re-consent
No extension on rotationNew tokens inherit the original expiryRFC 10017 6.3.2.3Always
Session bindingRefresh lifetime tied to the user's authenticated sessionRFC 10017 6.3.2.3 (SHOULD, browser clients)Browser and BFF clients
Event-based revocationRevoke on password change, logout, riskRFC 9700 4.14 (MAY)Password reset, admin revoke, account disable, incident

The starting points are NHI Mgmt Group suggestions, not values from the standards; set them per client risk. RFC 10017, the browser-based applications BCP, uses an 8-hour refresh token that rotates without extending the overall limit as its example for browser clients. See the OAuth for Browser-Based Applications and the BFF Pattern Guide.

Telling clients when tokens expire

The IETF OAuth working group is developing OAuth 2.0 Refresh Token and Authorization Expiration (draft-ietf-oauth-refresh-token-expiration-03, an active working group Internet-Draft last updated 6 July 2026, checked 27 October 2026). It defines token response parameters refresh_token_timeout (seconds a client may hold the refresh token without exchanging it) and authorization_expires_in (seconds the user's authorisation remains valid), plus an authorisation server metadata field refresh_token_expiration_types_supported, and extends introspection to return them. It is a draft and the names may change, but the design goal is useful now: clients that know when a grant ends can prompt re-consent instead of failing silently, which removes a common excuse for "never expire".

Sender-constrained refresh tokens

RFC 9700 offers sender-constraining as the alternative to rotation for public clients: the server binds the token to a key held by a specific client instance, using mTLS (RFC 8705) or DPoP (RFC 9449). A thief then needs the private key as well. RFC 10017 adds the limit for browsers: with a non-extractable DPoP key, a stolen token can only be abused online from the user's browser, but an attacker running code in the page can start a new flow and bind fresh tokens to their own key.

ApproachStops offline replay of a stolen tokenDetects theftClient complexityBest fit
Bearer, no rotationNoNoLowestNever for public clients
Rotation with reuse detectionPartly (until reuse is detected)Yes, on reuseLowSPAs and mobile apps where DPoP is not available
DPoP-boundYes, if the key is not exfiltratedProof failures are visibleMedium: key management, proofs per requestMobile, desktop and browser apps with non-extractable keys
mTLS-boundYesTLS failures are visibleMedium to high: certificatesConfidential server clients and integrations
Confidential client authenticationYes, unless the client secret is also stolenPartlyLowServer-side integrations; prefer private_key_jwt over shared secrets

For confidential clients RFC 6749 already restricts refresh tokens to the client they were issued to, but that only helps if the client credential is stored separately from the tokens. Integration vendors that keep tokens and client secrets in the same database lose both at once. See the DPoP Guide.

How platforms behave: check, do not assume

Vendor behaviour varies enough that runbooks must be written per platform. Examples from vendor documentation (checked 27 October 2026):

  • Microsoft Entra ID: default refresh token lifetime is 24 hours for SPAs and 90 days for most other scenarios. Each use returns a new refresh token, but the platform does not revoke the old one, so apps must discard it. A user password change revokes password-based tokens but leaves confidential client tokens alive; admin password reset and admin "revoke all refresh tokens" revoke both; single sign-out leaves both alive. See the Entra ID Primary Refresh Token Security Guide for the device-level token.
  • Okta: refresh tokens require the offline_access scope; SPAs use rotation by default, web and mobile apps default to persistent tokens and can be switched to rotation; reuse invalidates the most recent refresh token and access tokens issued since authentication, logged as app.oauth2.as.token.detect_reuse or app.oauth2.token.detect_reuse. The access policy refresh lifetime defaults to "Unlimited".
  • Auth0: with rotation enabled, reuse of an invalidated token invalidates the whole family and requires re-authentication; reuse events (such as ferrt) appear in tenant logs and can be streamed to a SIEM.

The lesson is that "rotation enabled" can mean full reuse detection, rotation without invalidation, or nothing by default. Read the documentation for each authorisation server and SaaS platform you depend on and test it.

Choosing a policy by organisation and client

  • Small organisations: you mostly consume SaaS and an identity provider, so your levers are their settings. Turn on rotation where offered, replace "unlimited" with a finite lifetime, review connected apps quarterly and revoke anything unused. That covers most of the risk with a few hours of work.
  • Large organisations: publish a refresh token standard per client class, enforce it in the authorisation server configuration as code, and report exceptions. Expect integration owners to resist re-consent; a long first ceiling reduces friction.
  • Rotation or DPoP: choose DPoP where the client platform can hold a non-extractable key and the authorisation server supports it; otherwise rotation with short grace periods. Use both where available.

Where identity fits

Most long-lived refresh tokens belong to non-human identities: integrations, automation scripts, CLIs and AI agents acting for a user with offline_access. They outlive the person who granted them, so record an owner for every grant and include agent and integration grants in access reviews. See the SaaS API Token Security Guide.

Implementation and rollout

  1. Inventory grants: export active refresh tokens or grants per client from each authorisation server and SaaS admin console: client, owner, scopes, issue date, last use. Sort by age; tokens older than a year are your first finding.
  2. Classify clients: public (SPA, mobile, desktop, CLI) versus confidential (server, integration); first-party versus third-party.
  3. Set policy per class: public clients get rotation or DPoP plus absolute expiry; integrations get absolute expiry with re-consent, IP or network restrictions where the platform supports them, and a named owner.
  4. Pilot in a ring: enable rotation and idle expiry on one first-party app in a test tenant; watch for spurious reuse events caused by parallel refreshes (multiple tabs or threads) and fix clients to serialise refresh.
  5. Apply absolute lifetimes gradually: start with a long ceiling (for example 365 days) so nothing breaks, then step down, communicating re-consent to integration owners.
  6. Revoke the legacy tail: revoke grants unused for 90 days and any held by departed owners or retired integrations, using RFC 7009 or the platform admin API. See the OAuth Token Introspection and Revocation Guide.
  7. Rollback: rotation can be relaxed per client (longer grace period) without disabling it; avoid switching back to non-expiring tokens.

Detection and measurement

Stream reuse-detection events to your SIEM and treat each as a potential theft until explained. Also alert on refreshes from a new ASN or country for the same grant, refresh bursts from integrations, and refresh tokens used after the owning user was disabled.

  • Maximum grant age: oldest active refresh token per platform, trending down to your absolute lifetime.
  • Coverage: share of public clients with rotation or sender-constraining, target 100%.
  • Reuse events: count per week and percentage investigated.
  • Dormant grants: active grants unused for 90 days, target zero.
  • Leaver residue: active grants belonging to disabled users or decommissioned integrations, target zero.

Framework mapping

FrameworkReferenceRelevance
OWASP ASVS 5.0V10.4.5 refresh token replay mitigation for public clients; V10.4.8 absolute expiration; V10.4.9 revocation by an authorised userDirect authorisation server requirements
NIST SP 800-53 Rev. 5IA-5 Authenticator Management; IA-5(13) Expiration of Cached Authenticators; AC-2(3) Disable Accounts; AC-12 Session TerminationLifetime limits and revocation
NIST CSF 2.0PR.AA-01; DE.CM-03Credential lifecycle and monitoring
ISO/IEC 27001:2022 Annex AA.5.17 Authentication information; A.5.18 Access rightsManaging secret authentication information and its removal
MITRE ATT&CKT1528; T1550.001Theft and reuse of tokens

Common failure patterns

  • "Unlimited" as the default: platform defaults leave refresh tokens valid indefinitely, and nobody changes them. The Gainsight tokens dating back to 2017 are the result.
  • Sliding expiry with no ceiling: regular use keeps a stolen token alive forever.
  • Rotation without invalidation: new tokens are issued but old ones still work, so there is no reuse to detect.
  • Relying on password reset: confidential client and integration tokens often survive it; containment needs explicit grant revocation.
  • Reuse events nobody reads: the platform detects theft, logs it, and the log is never forwarded.
  • Tokens and client secrets stored together: an integration vendor breach then yields fully usable tokens. Ask vendors how they store customer tokens. See the SaaS and OAuth App Governance Guide.

Practitioner checklist

  • Inventory active refresh grants per platform with client, owner, scopes, issue date and last use.
  • Set an absolute lifetime for every client class and confirm rotation never extends it.
  • Enable rotation with reuse detection, or DPoP or mTLS binding, for all public clients.
  • Keep rotation grace periods as short as clients tolerate.
  • Configure idle expiry and revoke grants unused for 90 days.
  • Forward reuse-detection events to the SIEM with an investigation runbook.
  • Add explicit grant revocation to leaver, password-compromise and vendor-breach playbooks.
  • Require integration vendors to describe token storage, expiry and IP restrictions.
  • Track the draft refresh token expiration parameters and adopt them when your platforms do.

Standards and references

Related NHI Mgmt Group resources: Token Lifetime Policy Design Guide · OAuth Token Introspection and Revocation Guide · OAuth Token Theft Incident Playbook · DPoP Guide · Gong, Drift and Sales Engagement OAuth Integration Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 27 October 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.