[英]Request failed with status code 401 at createError "Unauthenticated"
我正在使用 laravel 和 reactjs 我在注銷時遇到了這個問題
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;
});
那么logout api是干什么的呢,明顯是laravel的權限錯誤,從后台顯示logout方法。 還要檢查 your.network,您可以在那里看到完整的消息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.