Safeguard
Developer Tools•

How long do integration tokens last? A comparison by credential type

Integration credentials live for different times: one hour, eight hours, months or until revoked. A comparison table and what to do about long ones.

Safeguard Security Team
3 min read

It depends on the credential. A GitHub App installation token lasts about an hour. A GitHub OAuth app token is long-lived by default. A Google refresh token can last until revoked or unused for six months. A static API key lasts until someone expires it. Choose shorter where you can.

Comparison from vendor documentation

CredentialDocumented lifetimeSource of the rule
GitHub App installation tokenExpires after a predefined time, currently 1 hourGitHub docs
GitHub OAuth app tokenLong-lived by default, optional expiry after eight hours with a refresh tokenGitHub docs
Google OAuth refresh tokenUntil revoked, or invalid after six months unused, with other conditionsGoogle docs
Google refresh token, external app in TestingExpires after 7 days (basic profile scopes excepted)Google docs
Stripe API keyUntil expired or rotated; rotation offers an overlap of up to 7 daysStripe docs
Slack incoming webhook URLUntil the app or URL is removedSlack docs describe it as containing a secret

The last row's lifetime is inferred from the documentation, which does not give an expiry. Treat it as no automatic expiry.

Why lifetime matters

A stolen credential is useful for as long as it works. An hour limits an attacker's window. A token with no expiry gives them months. Standards guidance points the same way. RFC 9700, the OAuth security best current practice, says access token privileges should be restricted to the minimum required, that tokens should be audience restricted, and that refresh tokens for public clients must be sender constrained or use rotation.

How to shorten the long ones

  1. Prefer app or installation credentials that expire over personal tokens, where the platform offers both.
  2. If you must use long-lived credentials, scope them to the minimum and give each integration its own.
  3. Set a calendar rotation and an owner.
  4. Use access policies or network limits that the provider offers, so a stolen key fails from other places.
  5. Alert on use from unfamiliar addresses.
  6. Remove credentials that logs show are unused.

Short does not mean safe

A one hour token can still do a lot in an hour. Limit what it can do as well as how long it lives. Short lifetimes also shift work to your code: it must refresh cleanly, and a failure to refresh will break the integration. Build alerts for authorization errors.

Quick check

Is a longer token lifetime ever acceptable?

Yes, for low-risk, read-only jobs with a named owner and a rotation date. Document the decision.

What does sender-constrained mean?

The token is bound to the client that received it, so a thief cannot simply replay it. Common methods are mutual TLS and DPoP.

Safeguard's policies and compliance evidence automation can record credential rotation as a repeating control. Try the free scan at gold.safeguard.sh/scan.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.