New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vue-admin-template里通过axios发起请求,携带不了cookie给后端 #2600
Comments
而且withCredentials: true, 已经打开了,vue.config.js里边也已经移除掉了devserver的proxy和after,麻烦帮忙看下是怎么回事。 |
为什么要移除代理,代理的目的就是为了 解决跨域问题的 |
移除这个是为了彻底移除掉mock.js,因为我的数据是从后端取得。跨域我后段也做了处理的。而且跨域的话,前端浏览器控制台会报错的吧,我的控制台没看到报错 |
withCredentials的情况下,后端要设置Access-Control-Allow-Origin为你的源地址,例如http://localhost:8080,不能是*,而且还要设置header('Access-Control-Allow-Credentials: true'); |
嗯,后端设置的白名单,
|
你解决了吗,想问下你怎么解决的? |
我也想问下你解决了吗?怎么解决的,我也遇到了~ |
解决了吗?这个问题我也遇到了 |
@huangguang93 看看以下4點有沒有做對
export function getToken() {
return sessionStorage.getItem(TokenKey)
}
export function setToken(token) {
return sessionStorage.setItem(TokenKey, token)
}
export function removeToken() {
return sessionStorage.removeItem(TokenKey)
} |
你好,最近基于vue-admin-template做了个后台,是前后端分离的,后端用的python。在权限这块儿,遇到个问题,登陆成功后,服务器返回了token给前端,前端将token保存在cookie里,再请求其他接口时,没有把cookie传递给后端。
如图,
The text was updated successfully, but these errors were encountered: