Antonio Braccolino, Identity & Access, home
EN · Language: English
← All terms

IAM glossary

What is Refresh token?

A long-lived token used to get new access tokens without signing in again. With rotation, each use returns a new one and reusing an old one revokes the whole chain.

How it works

Access tokens should be short-lived, but users do not want to sign in every 10 minutes. The refresh token solves this: it is a long-lived credential that the app sends to the token endpoint to get a new access token without bothering the user.

Because it lasts long, it is valuable to attackers. Good practice: keep it on the server or in secure storage, bind it to the client, rotate it on every use (the old one stops working) and revoke it on logout. With rotation, if a stolen refresh token is used twice, the server notices and revokes the whole chain.

A simple example

A mail app gets an access token valid 15 minutes and a refresh token valid 30 days. Every 15 minutes it silently gets a new pair. When you press “Sign out of all devices”, the server revokes the refresh tokens and within 15 minutes every device is logged out.

Common mistakes

  • Keeping refresh tokens in localStorage in the browser.
  • No rotation and no revocation: a stolen token works for months.
  • Logout that only deletes the local copy and leaves the token valid on the server.

See it at work