onTokenAttached property

void Function(Token token, RequestOptions options)? onTokenAttached
final

Called each time a token is successfully attached to an outgoing request.

Receives the Token that was attached and the RequestOptions for the request. Useful for per-request logging, analytics, or debugging without adding a separate tokenStream subscription.

TokenKeeperInterceptor(
  keeper: keeper,
  dio: dio,
  onTokenAttached: (token, options) {
    logger.debug('${options.path}: ${token.maskedAccessToken}');
  },
);

Implementation

final void Function(Token token, RequestOptions options)? onTokenAttached;