Skip to content

What is a Refresh Token

Key idea:

Refresh token — a long-lived token (weeks/months) the client uses to obtain new short-lived access tokens without re-authenticating. Typical flow: access_token lives 15 min, refresh_token 30 days. When access expires, the client POSTs the refresh to the token endpoint → gets a new access. Critical: keep refresh in secure storage (httpOnly cookie, not localStorage).

Below: details, example, related terms, FAQ.

Details

  • Access token: short-lived (5-15 min), sent on every request
  • Refresh token: long-lived (30+ days), only to token endpoint
  • Rotation: on refresh use, a new refresh is issued and old is revoked
  • Revocation list: Redis/DB with invalidated tokens
  • Grace period: 30 sec for race conditions on concurrent refreshes

Example

POST /oauth/token
  grant_type=refresh_token
  refresh_token=XXX
  client_id=Y
→ { access_token: "...", refresh_token: "NEW", expires_in: 900 }

Related Terms

HeadersCSP, HSTS, X-Frame-Options, etc.
SSL/TLSEncryption and certificate
ConfigurationServer settings and leaks
Grade A-FOverall security score

Why teams trust us

OWASP
guidelines
15+
security headers
<2s
result
A–F
security grade

How it works

1

Enter site URL

2

Security headers analyzed

3

Get grade A–F

What Does the Security Analysis Check?

The tool checks HTTP security headers, SSL/TLS configuration, server info leaks, and protection against common attacks (XSS, clickjacking, MIME sniffing). A grade fromA to F shows overall security level.

Header Analysis

Checking Content-Security-Policy, HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy, and more.

SSL Check

TLS version, certificate expiry, chain of trust, HSTS support.

Leak Detection

Finding exposed server versions, debug modes, open configs, and directories.

Report with Recommendations

Detailed report explaining each issue with specific steps to fix it.

Who uses this

Security teams

HTTP header audit

DevOps

config verification

Developers

CSP & HSTS setup

Auditors

compliance checks

Common Mistakes

Missing Content-Security-PolicyCSP is the primary XSS defense. Without it, script injection is much easier.
Missing HSTS headerWithout HSTS, HTTPS-to-HTTP downgrade attacks are possible. Enable Strict-Transport-Security.
Server header exposes versionServer: Apache/2.4.52 helps attackers find exploits. Hide the version.
X-Frame-Options not setSite can be embedded in iframe for clickjacking. Set DENY or SAMEORIGIN.
Missing X-Content-Type-OptionsWithout nosniff, browsers may misinterpret file types (MIME sniffing).

Best Practices

Start with basic headersMinimum: HSTS, X-Frame-Options, X-Content-Type-Options, Referrer-Policy. Takes 5 minutes.
Implement CSP graduallyStart with Content-Security-Policy-Report-Only, monitor violations, then enforce.
Hide server headersRemove Server, X-Powered-By, X-AspNet-Version from responses.
Configure Permissions-PolicyRestrict camera, microphone, geolocation access — only what is actually used.
Check after every deploySecurity headers can be overwritten during server configuration updates.

Get more with a free account

Security check history and HTTP security header monitoring.

Sign up free

Learn more

Frequently Asked Questions

Where to store a refresh token?

Server-side: session/database. Client-side: httpOnly + Secure + SameSite=Strict cookie. Never localStorage — XSS risk.

What to do on suspected leak?

Revoke all refresh tokens for the user via <code>DELETE /tokens WHERE user_id=X</code>. User must relogin.

Refresh rotation — required?

Best practice. Especially for SPAs. OAuth 2.1 draft mandates rotation.