top of page

What is Refresh Token?

Oct 27
7 min read

Updated: Oct 28

What is Refresh Token?

 

A refresh token is a credential that an authorised application can present to an authorisation server to obtain a new access token. It can let an application continue accessing an approved service without asking the user to sign in for every access token renewal.

 

A refresh token is not an access token and is not normally sent to the protected API. It may expire, be revoked or be replaced, and receiving one is not guaranteed. Its security matters because someone who can successfully misuse it may be able to obtain further access tokens.

 

How does a refresh token work?

 

In an OAuth 2.0 flow, a client receives an access token and, if the authorisation server chooses to issue one, a refresh token. The access token is presented to the protected resource. When the client needs a new access token, it sends the refresh token to the authorisation server's token endpoint over a protected connection.

 

The authorisation server checks the refresh token, its relationship to the client, the grant and any applicable restrictions. A confidential client also authenticates as required by the server. If the request is accepted, the server issues a new access token and may issue a replacement refresh token. If it rejects the request, the application must follow the provider's recovery or authorisation process.

 

The illustration shows a simplified cycle: an access token is issued, it expires, the client sends a refresh token to the authorisation server, the server validates it and a new access token is issued. A client can refresh before expiry, and actual flows vary.

 

Refresh token infographic showing access token expiry, renewal and authorisation server validation

 

The OAuth 2.0 framework, RFC 6749, describes refresh tokens and the refresh grant. Our access token guide explains the credential used to access the API itself.

 

Why use a refresh token?

 

A service can issue a comparatively short-lived access token while allowing an authorised application to request another later. If an access token is exposed, its limited lifetime can reduce the period of potential misuse. The refresh token remains sensitive, however, because it can support continued access under the associated grant.

 

A refresh token also helps reduce repeated sign-in interruptions. That convenience is conditional: an authorisation server can refuse to renew access, require a fresh grant or apply other policy. A refresh token is not an indefinite login and does not replace a secure account recovery process.

 

Refresh token vs access token

 

Feature

Refresh token

Access token

Purpose

Request new access tokens when permitted

Present authorisation to a protected resource

Recipient

The authorisation server's token endpoint

The intended resource server, such as an API

Lifetime

Provider-specific and often longer

Provider-specific and often shorter

Permissions

Tied to the authorised grant and its restrictions

Represents access granted for the resource and scope

Exposure risk

May allow continued token issuance

May allow use of the affected resource until rejected

Revocation

May stop subsequent renewal

May stop API use, subject to enforcement and propagation

 

These are typical roles, not a guarantee that every provider uses identical formats, durations or policies. An access token can be opaque or a JWT. A refresh token's format is also implementation-specific; clients should handle it according to the provider's instructions rather than assuming they can interpret it.

 

A practical broadband example

 

Imagine a UK network monitoring application authorised to read status information from a broadband provider's API. The authorisation server issues a short-lived access token and a refresh token for the approved client. The application uses the access token to request status data. Later, it sends the refresh token to the authorisation server to obtain another access token, subject to the grant and provider policy.

 

This is an illustrative scenario, not a claim that a particular provider offers such an API. Renewal does not automatically grant write access, change broadband speed or keep a network connection alive. A valid token still has to be accepted by the API for the specific request.

 

What is refresh token rotation?

 

Rotation replaces a refresh token with a new one during a successful refresh and invalidates the previous token according to the provider's implementation. The application must store the replacement and stop using the old value. If an attacker and the legitimate client both use the same token family, a subsequent use of an invalidated token can reveal possible replay.

 

The authorisation server cannot necessarily tell which party is the attacker. In the rotation approach described by RFC 9700, OAuth 2.0 Security Best Current Practice, detection can cause the active refresh token to be revoked, requiring a fresh authorisation grant. Rotation detects certain reuse patterns; it does not guarantee immediate detection of a stolen token that an attacker uses before the legitimate client.

 

RFC 9700 requires authorisation servers issuing refresh tokens to public clients to use either sender-constrained refresh tokens or rotation to detect malicious replay. The requirement is scoped to those public clients; confidential clients have different authentication and binding considerations. Provider-specific overlap or retry policies can affect how concurrent requests and lost responses are handled.

 

What are sender-constrained refresh tokens?

 

A sender-constrained token is bound to a particular client instance using a cryptographic mechanism. The client must demonstrate the required proof when using the token. A copied token alone is therefore less useful to an attacker who cannot use the corresponding key.

 

Examples include mutual TLS and DPoP, where supported by the service. These controls reduce certain replay risks but do not eliminate compromise if an attacker can also access the key or cause the authorised client to perform requests. They need correct implementation on both sides.

 

Do refresh tokens expire?

 

They can. Providers may apply an absolute expiry, an inactivity limit, revocation after a security event or other restrictions. Some use rotation, some use sender constraints, and policies vary. Do not assume a refresh token lasts forever or that all providers use a fixed lifetime.

 

A user's password change or sign-out may cause a provider to revoke a refresh token, but behaviour is not universal. Likewise, revoking a refresh token does not necessarily invalidate every previously issued access token immediately. Resource servers may validate access tokens differently or cache status; check the provider's documented behaviour.

 

What happens when a refresh token is rejected?

 

The token may have expired, been revoked, already been rotated, been issued to a different client or failed a required proof or client-authentication check. The underlying grant may also no longer be valid. Network errors and a token endpoint rejection are different problems.

 

  1. Confirm the application is contacting the correct authorisation server and token endpoint over TLS.

  2. Check the provider's documented error response without logging the token value.

  3. Verify that the application stored and is using the latest refresh token if rotation is enabled.

  4. Check for simultaneous refresh attempts, failed writes, lost responses, client configuration or a missing sender-constraining key.

  5. Review expiry, revocation and grant status through the provider's supported tools.

  6. If renewal is no longer allowed, follow the normal authorisation process again and update dependent services safely.

 

A reusable application should coordinate concurrent refresh requests and handle failures according to the provider's rules. Blindly retrying an old rotated token can be mistaken for replay and may cause the active token to be revoked. Never paste a real token into a support ticket or diagnostic screenshot.

 

How should refresh tokens be stored and protected?

 

  • Send refresh tokens only to the intended authorisation server using its documented protected channel.

  • Keep them out of URLs, source code, public repositories, analytics, screenshots and logs.

  • Store them in a protected location appropriate to the application and operating environment, limiting which processes and people can read them.

  • Use rotation or sender constraints when supported and required, and handle replacement tokens atomically so they are not lost or used concurrently.

  • Give the client the minimum required access and bind the grant to the intended scope and resources.

  • Monitor and revoke unused or compromised grants, and provide a reliable route for users or administrators to remove access.

  • Use established OAuth libraries and the provider's supported flow instead of inventing token handling.

 

A browser or mobile application cannot be assumed to protect a shared client secret from its own user. Storage choices and risks depend on the client architecture, available platform protections and threat model. Encrypting a token at rest does not solve a compromised application that can decrypt and use it.

 

What happens if a refresh token is exposed?

 

Treat it as a potential ongoing access risk. Use the provider's official process to revoke the refresh token or underlying grant and investigate affected accounts and activity. Replace affected credentials and reauthorise through a trusted route. Determine whether issued access tokens must also be revoked or allowed to expire, and review provider logs and propagation behaviour.

 

RFC 7009 defines an OAuth token revocation endpoint where implemented. It permits related tokens or a grant to be invalidated according to the server's policy; it does not guarantee that every resource server will enforce the change instantly.

 

Refresh token, ID token and session

 

An access token authorises a client to request a protected resource. A refresh token can obtain new access tokens. An OpenID Connect ID token communicates an authentication result to the client, while an application session maintains continuity under that application's own rules. These are distinct roles, even if a provider uses them together.

 

OAuth describes authorisation, while OpenID Connect adds an identity layer. A token refresh is not necessarily a new user authentication. Our guides to OAuth, OpenID Connect and session management explain those connections.

 

Frequently asked questions

 

Is a refresh token sent to the API?

 

Normally no. The client sends it to the authorisation server's token endpoint. The access token is presented to the intended resource server.

 

Does every OAuth flow provide a refresh token?

 

No. Issuance depends on the grant, client, authorisation server and its policy. Some applications obtain new access tokens using another supported flow.

 

Is a refresh token a password?

 

It is a sensitive credential, but it represents an authorisation associated with a client and grant rather than the user's reusable account password.

 

Can a refresh token expire?

 

Yes. A provider may set an expiry, inactivity limit or other conditions, and can revoke it according to its policy.

 

Does refresh token rotation stop every theft?

 

No. It can reveal certain reuse patterns, but a stolen token may be used before detection. Sender constraints, secure storage and monitoring address other parts of the risk. When supported, a replacement refresh token makes reuse of an older one detectable under the issuer's rules. That requires correct client storage and server enforcement. Investigate reuse alerts, revoke the affected authorisation where appropriate and check separately whether existing access tokens remain accepted.

 

Does refreshing an access token mean the user has signed in again?

 

Not necessarily. Refreshing obtains a new access token under an existing authorisation. A service may separately require reauthentication or renewed consent.

 

Does revoking a refresh token end existing access tokens?

 

Not always immediately. The effect depends on the provider, associated grant and how resource servers check or cache access token status.

 

Key takeaway

 

A refresh token allows an authorised client to request new access tokens from an authorisation server. Protect it as a valuable credential, understand the provider's expiry and revocation rules, and implement rotation or sender constraints where required or appropriate.

 
 
UK Techie Broadband Providers
bottom of page