'Request failed with status code 401 at createError "Unauthenticated"

I'm using laravel with reactjs I'm getting this problem when I'm doing logout

1

axios.defaults.withCredentials = true;
// axios.defaults.headers.common = {'Authorization': 'bearer ' + localStorage.getItem('auth_token')}
axios.interceptors.request.use(function (config){
    const token = localStorage.getItem('auth_token');
    // config.headers["Authorization"] = "bearer " + token;
    config.headers.Authorization = token ? `Bearer ${token}` : '';
    return config;
});


Solution 1:[1]

So what does that logout api do this is clearly a permission error coming from laravel. Show the logout method from the backend. Also check your network you can see the full message there.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Muresan Andrei