liveBook · Manning

Refresh token

As explained in Software Security for Developers

A refresh token is a credential that a client presents to an authorization server to obtain a new access token without repeating the user authorization interaction.

A refresh token is a credential that a client presents to an authorization server to obtain a new access token without asking the user to authenticate again. It balances security and convenience: access tokens expire after a short period, while refresh tokens keep sessions smooth. section 13.2 section 13.6

A typical refresh-token arrangement works as follows:

  • Register the client with the authorization server to receive refresh tokens. section 13.2
  • Receive an access token and refresh token after the initial authorization-code flow, with or without PKCE. section 13.2
  • Use the refresh token to request a new access token after the short-lived access token expires. section 13.2
  • Protect refresh tokens by storing them securely, rotating them after use, setting expiration times, and revoking them after suspicious activity. section 13.5

A token response with renewal support

A response from the token endpoint can include an access token, a refresh token, its scope, bearer type, and a five-minute expiration. The client can later exchange the refresh token for a new access token instead of prompting the user to log in again. section 13.2

Figure 13.4 The refresh-token flow. When a client is registered to use refresh tokens, it receives both an access token and a refresh token from the authorization server. The client can use the refresh token to seamlessly request a new access token without requiring additional user interaction. This approach maintains security while providing a smooth, uninterrupted user experience.
figure

Trace the refresh-token flow from client registration and initial token issuance to obtaining a replacement access token without additional user interaction. section 13.2

How Software Security for Developers covers it

How deep it goes
Explains registration, paired token issuance, renewal, and protection practices, but does not detail the token-exchange request mechanics.
Examples
Uses an ACME shopping session, token-endpoint responses, a five-minute expiry, and exercises about purpose, lifetime, and protection.
What it assumes
Builds on access tokens and the authorization code flow while connecting refresh-token use with PKCE for public clients.
What you can do after
Operate session renewal by registering clients, handling refresh-token responses, and applying storage, rotation, expiration, and revocation safeguards.
How it connects
Connects refresh tokens to OAuth 2, OpenID Connect, access tokens, authorization code flow, and PKCE.

Also explained in

Compare how 3 books explain refresh token →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Software Security for Developers. The section links point to the parts of the book it draws on.