The code provided here -
const instance = axios.create({
baseURL: process.env.URL,
headers : {
'Authorization': `Bearer ${token}`
}
})
will run only once You need to use interceptors to retrieve and pass the token for each network request. Reference: https://axios-http.com/docs/interceptors