TokenRefreshStrategyImpl constructor

TokenRefreshStrategyImpl({
  1. required TokenRefreshHandler refreshHandler,
  2. required TokenExtractor accessTokenExtractor,
  3. required TokenExtractor refreshTokenExtractor,
  4. List<int> successCodes = const [200],
  5. List<int> refreshCodes = const [401],
  6. Map<String, String> authTemplate = const {'Authorization' : 'Bearer '},
  7. int retries = 1,
})

Creates a TokenRefreshStrategyImpl with the given parameters.

  • refreshHandler: The handler function used to perform the token refresh.
  • accessTokenExtractor: The function used to extract the access token from the response.
  • refreshTokenExtractor: The function used to extract the refresh token from the response.
  • successCodes: The list of status codes indicating a successful token refresh. Default is 200.
  • refreshCodes: The list of status codes indicating the need to refresh the token. Default is 401.
  • authTemplate: The template for the authorization headers. Default is {'Authorization': 'Bearer '}.
  • retries: The number of retry attempts for refreshing the token. Default is 1.

Implementation

TokenRefreshStrategyImpl({
  required this.refreshHandler,
  required this.accessTokenExtractor,
  required this.refreshTokenExtractor,
  this.successCodes = const [200],
  this.refreshCodes = const [401],
  this.authTemplate = const {'Authorization': 'Bearer '},
  this.retries = 1,
});