【发布时间】:2018-07-26 09:51:27
【问题描述】:
使用 VUE 2 和插件 vue-auth (https://github.com/websanova)。无论出于何种原因,在 IE 和 Edge 中,身份验证令牌都会在页面刷新时从 localStorage 中删除,但在 Chrome 中,FF 一切正常,并且不会删除令牌。
我一直在使用 chrome 进行开发,并且即将推出产品。正在其他浏览器中进行测试,然后在开发阶段接近尾声时遇到了这个问题。使用他们的文档,我基本上是在没有任何实际更改的情况下进行设置。
Vue.use(require('@websanova/vue-auth'), {
auth: require('@websanova/vue-auth/drivers/auth/bearer.js'),
http: require('@websanova/vue-auth/drivers/http/axios.1.x.js'),
router: require('@websanova/vue-auth/drivers/router/vue-router.2.x.js'),
refreshData: {enabled: false},
});
Vue.auth.login({
method: 'post',
data: {email: payload.email, password: payload.password, rememberMe: true},
}).catch(error => {
console.log('error happened');
console.log(error);
})
打开 IE,进入页面,登录,查看 localStorage default_auth_token 是否存在。 按 F5 用户被注销。 Vuew localStorage 和 default_auth_token 不见了。
在 IE 中完全一样。
除了禁用刷新令牌选项之外,我没有对他们的插件进行任何自定义操作,因为我们不使用它们。
我知道在这里寻找修复可能是一个漫长的过程,但我已经尝试使用 github 问题 (https://github.com/websanova/vue-auth/issues/309) 无济于事。
【问题讨论】:
标签: javascript vuejs2 jwt