We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import createAuthRefreshInterceptor from 'axios-auth-refresh'; const authToken = Buffer.from(`${aws.production!.outbrain.user}:${aws.production!.outbrain.password}`).toString('base64'); const fetchAccessToken = cachedFunction(OutbrainUtils.fetchAccessToken); const client = axios.create({ baseURL: `${aws.production!.outbrain.urlApi}${context.user!}`, timeout: moment.duration(10, 'second').asMilliseconds(), }); const refreshAccessToken = async (failedRequest: AxiosError) => { await invalidateCache(fetchAccessToken, [authToken]); const accessToken = await fetchAccessToken(authToken) as CachedFunctionResult<Promise<string>>; failedRequest.config!.headers['OB-TOKEN-V1'] = await accessToken.result; return client.request(failedRequest.config!); }; createAuthRefreshInterceptor(client, refreshAccessToken, {statusCodes: [StatusCodes.UNAUTHORIZED]}); client.interceptors.request.use(async request => { const accessToken = await fetchAccessToken(authToken) as CachedFunctionResult<Promise<string>>; request.headers['OB-TOKEN-V1'] = await accessToken.result; return request; }); return client;
But I get ERROR: createAuthRefreshInterceptor is not a function.
ERROR: createAuthRefreshInterceptor is not a function
This is the version in my package.json:
"axios-auth-refresh": "^3.3.6",
What am I missing?
The text was updated successfully, but these errors were encountered:
It works if I do
createAuthRefreshInterceptor.default(client, refreshAccessToken, {statusCodes: [StatusCodes.UNAUTHORIZED]});
...
Sorry, something went wrong.
No branches or pull requests
But I get
ERROR: createAuthRefreshInterceptor is not a function
.This is the version in my package.json:
What am I missing?
The text was updated successfully, but these errors were encountered: