Cybersecurity glossary

What is OAuth Token Theft?

Learn what OAuth token theft is, how access and refresh tokens are stolen from browsers apps and logs, what attackers do with them, and how short lifetimes binding and secure storage reduce impact.

Identity and accessUpdated July 20, 2026
Also known asStolen OAuth tokensBearer token theftAccess token leakage

Definition

OAuth token theft is the unauthorized acquisition of OAuth access tokens, refresh tokens, or authorization codes—through XSS, malware, misdirected redirects, insecure storage, or log leakage—allowing attackers to access APIs as the victim client or user.

Why OAuth token theft matters

OAuth replaces password sharing with tokens. That is an improvement—until tokens themselves become the prize. OAuth token theft lets attackers call APIs with the victim’s delegated authority, often silently, until expiry or revocation.

Because bearer tokens are commonly accepted with only possession proof, a leaked string can be as powerful as a session cookie—and sometimes more powerful across multiple APIs.

How token theft happens

Browser XSS

Scripts read tokens from localStorage, sessionStorage, or in-page memory and exfiltrate them.

Redirect / misconfig delivery

Codes or tokens are sent to attacker-controlled URIs via unsafe OAuth redirects.

Insecure storage

Mobile apps or desktops store refresh tokens in world-readable locations.

Logs and support tooling

Authorization headers and token responses are written to centralized logs.

Malware / extensions

Endpoint compromise harvests tokens from browsers and app data directories.

Network cleartext

Non-TLS channels or broken TLS validation expose bearer headers in transit.

Attack progression

1

Obtain a token or code

Steal via XSS, malware, misdirected redirect, or leakage.

2

Replay against APIs

Call resource servers with Authorization: Bearer until rejected.

3

Refresh for persistence

If a refresh token was stolen, mint new access tokens repeatedly.

4

Expand via scopes

Use whatever scopes were granted—mail, files, admin APIs—to achieve objectives.

5

Evade detection

Keep request volume similar to the legitimate client where possible.

6

Force defender response

Revocation, rotation, and root-cause removal end the theft window.

Reducing impact

ControlWhy it helps
Short access-token TTLLimits the useful lifetime of a stolen access token
Refresh rotation + reuse detectionTurns stolen refresh tokens into detectable events
Least-privilege scopesReduces blast radius per stolen token
HttpOnly / BFF patternsKeeps tokens out of JavaScript where practical
Sender-constrained tokensDPoP/mTLS binding makes pure bearer replay harder

Prevention checklist

  • Eliminate XSS and other client-side token exfiltration bugs.
  • Never log Authorization headers or token endpoint responses in plaintext.
  • Store refresh tokens in secure platform storage; encrypt at rest where possible.
  • Prefer short-lived access tokens and rotating refresh tokens.
  • Fix OAuth redirect misconfigurations that can deliver tokens to attackers.
  • Monitor for impossible travel and anomalous API use with valid tokens.
  • Provide users and admins a way to review and revoke grants.
  • Consider sender-constrained access tokens for high-risk APIs.

The practical takeaway

OAuth token theft steals the bearer credentials OAuth issues—access tokens, refresh tokens, or codes—and replays them against APIs. HTTPS alone does not stop theft from XSS, malware, or logs.

Issue least privilege, expire quickly, store carefully, detect refresh reuse, and revoke fast. Treat every token as a portable key that will eventually be exposed somewhere.

Related security terms

Frequently asked questions

What is OAuth token theft in simple terms?

It means someone steals the digital keys OAuth gave an app to access your data. With those tokens, they can call APIs as if they were the app acting for you—often without your password.

Which tokens are most dangerous to steal?

Refresh tokens and long-lived access tokens are especially dangerous because they provide lasting API access. Authorization codes are also high value if they can still be exchanged.

How do attackers steal OAuth tokens?

Common paths include XSS reading tokens from storage, malicious browser extensions, insecure mobile storage, open redirect/OAuth misconfig delivering tokens to attackers, malware, and tokens written to logs.

Does HTTPS prevent token theft?

HTTPS protects tokens in transit on the network. It does not stop XSS, malware on the device, or server-side log leakage.

How should access tokens be stored in SPAs?

Prefer patterns that avoid long-lived tokens in JavaScript-readable storage. Many designs use short-lived access tokens with careful cookie strategies or backend-for-frontend helpers. Avoid localStorage for high-value tokens when XSS is a concern.

What is refresh token rotation?

Each refresh issues a new refresh token and invalidates the previous one. Theft then becomes detectable when both attacker and victim try to refresh.

How do you respond to suspected token theft?

Revoke refresh tokens, invalidate sessions, rotate client secrets if exposed, force re-authentication, review grants, and investigate XSS or malware root causes.

References

Explore authoritative guidance and frameworks related to oauth token theft.

Explore every security definition

Return to the glossary to search by term, alias, starting letter, or security category.

Browse glossary