Skip to content

Services ITokenRefresher

Mika Berglund edited this page Dec 25, 2025 · 2 revisions

Token Refresher Service (ITokenRefresher)

The Token Refresher Service is responsible for acquiring new access and identity tokens using an existing refresh token when previously issued access tokens have expired. It encapsulates the logic required to interact with the token endpoint and to update the application's token state accordingly.

The service does not initiate authentication flows. It operates only when a refresh token is available and token refresh is required.

Responsibilities

  • Refresh access and identity tokens using a valid refresh token
  • Interact with the token endpoint using the OAuth 2.0 refresh token grant
  • Update the Access Token and Identity Token using the token store with newly issued tokens
  • Update the Refresh Token Store when a new refresh token is returned
  • Notify the application authentication infrastructure when the authenticated user state changes

Service contract

The Token Refresher Service is defined by the ITokenRefresher interface.

Members

  • RefreshTokensAsync: Refreshes tokens using the provided refresh options and returns a value indicating whether the refresh operation succeeded

Default implementation

The default implementation, Token Refresher, coordinates several supporting services to perform token refresh operations:

Identity tokens are validated to ensure that the aud claim matches the configured client ID before being stored. Access tokens are stored only when resource scopes are present in the refresh request.

The default implementation supports refresh operations across multiple scope groups and updates token state incrementally for each group.

Related services

References

Clone this wiki locally