DEV Community

Discussion on: How to auto-refresh jwts using Axios interceptors

Collapse
 
modeverv profile image
norainu

thanks.

with my api need to set header a refresh token,
so I need to set auth header and skip config.

in axios.js

      if (!config.url.endsWith('/token/refresh')) {
          const token = store.getters.accessToken;
        if (token) {
          config.headers.Authorization = `Bearer ${token}`;
        }
      }
Enter fullscreen mode Exit fullscreen mode