A library to cache and automatically refresh authentication tokens for Axios requests, with support for expiring tokens and recovery from early revocation. Version 1.0.1 is the latest. It adds request and response interceptors to an Axios instance, fetching and applying tokens, and retries failed requests with a new token on 401/403 errors. Differentiated by built-in recovery cycle and configurable callbacks, suitable for both Node.js and browser. Release cadence is low, with infrequent updates.
npm install axios-token-managerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Initialize TokenManager with a fetchToken function and apply to an Axios instance to auto-manage authorization headers.
Upgrade to version >=1.0.0 or latest.
Migrate to new 'recovery' configuration as per migration guide.
Use separate Axios instances for different TokenManagers.
Ensure the returned object includes both fields as shown in the quickstart.
Check the return structure of fetchToken; it must include { access_token: string, expires_in: number }.Use import { TokenManager } from 'axios-token-manager' instead of import TokenManager from 'axios-token-manager'.Provide an Axios instance created with axios.create() as the axiosInstance option.