DEV Community

Discussion on: How to Refresh Json Web Tokens (JWT) using Axios Interceptors

Collapse
 
ahmad_butt_faa7e5cc876ea7 profile image
Ahmad

great and consise article, thanks!

looking at the memoization, any reason for choosing this value for maxAge? just wondering

const maxAge = 10000;

export const memoizedRefreshToken = mem(refreshTokenFn, {
maxAge,
});

Collapse
 
franciscomendes10866 profile image
Francisco Mendes • Edited

Thanks for the feedback! Regarding the value of maxAge, in the article I put ten seconds but I usually use a value close to twenty. This is because http requests may have a timeout (maybe not the best word to describe it) which may be longer than maxAge value.