Refresh Token
What Is a Refresh Token?
A refresh token is a long-lived credential that lets an application obtain a new access token without asking the user to sign in again. In OAuth and OpenID Connect, the app sends it only to the authorization server's token endpoint, not to the resource API. It is not the user's password.
How Refresh Tokens Work
- The user signs in and approves requested access.
- The authorization server issues an access token and, when permitted, a refresh token.
- When the access token expires, the app sends the refresh token to the token endpoint.
- The server validates it and returns a new access token, sometimes with a replacement refresh token.
Access Token vs Refresh Token
Role matters more than format. Either token may be a JWT or an opaque string.
| Feature | Access token | Refresh token |
|---|---|---|
| Purpose | Calls an API | Obtains new access tokens |
| Recipient | Resource API | Authorization server |
| Lifetime | Usually short | Usually longer |
| Storage | Limit exposure | Protect like a password |
Learn more about an access token and the broader meaning of a token.
Benefits of Refresh Tokens
They balance session continuity with shorter-lived API credentials.
- Users avoid repeated sign-ins.
- Expired access tokens can be replaced without re-entering credentials.
- Approved API access can continue under server controls.
Practical Limits and Security Risks
A refresh token can extend access, so compromise is serious.
- It may expire, be revoked, or stop working after logout or withdrawn consent.
- It cannot grant scopes the user or server did not approve.
- Some OAuth clients and flows are not issued refresh tokens.
Refresh Token Security Best Practices
Treat a refresh token like a password.
- Use HTTPS, least-privilege scopes, and secure platform storage.
- Avoid browser-accessible storage where possible, and never log tokens.
- Use rotation and reuse detection when supported.
- Revoke compromised tokens and require sign-in after a failed refresh.
Refresh Tokens in Apps Built With Emergent
When building API-connected products, app design and development should include secure token handling from the start. Emergent can help teams build full-stack workflows that use OAuth integrations while keeping refresh and access-token responsibilities clear. Build secure API integrations with Emergent.
on Emergent today

