Skip to main content

Command Palette

Search for a command to run...

Difference between refresh token and access token

Published
1 min read

Refresh tokens and access tokens are both used in token-based authentication systems, often in OAuth 2.0, but serve different purposes:

Access Token

1. Purpose: Used to access protected resources, like APIs.

2. Lifetime: Short-lived (usually minutes to hours).

3. Content: Contains scopes and durations of access.

4. Security: High risk if exposed, as it grants immediate access.

5. Usage: Sent with each request to a resource server.

Refresh Token

1. Purpose: Used to obtain a new access token when the current one expires.

2. Lifetime: Long-lived (can be days to indefinitely).

3. Content: Usually opaque, not containing much information.

4. Security: More secure; often used only with the authorization server.

5. Usage: Only sent to the authorization server to get a new access token.

The refresh token helps maintain a user's session longer without requiring them to re-authenticate while minimizing the risk of long-lived access tokens.

more info