我不知道在从vuejs获得访问令牌后要做什么,以及如何通过令牌登录用户
在我构建了登录前端之后,我现在已经连接到django后端。我正在使用simplejwt。 我已成功获取令牌,但如何登录?当我检查api后端时,它并没有登录,只是我只获得了访问令牌和刷新令牌
这是我的store.js片段
actions: {
userLogin(context, { email, password }) {
getAPI
.post("/token/", {
email: email,
password: password
})
.then(response => {
context.commit("updateStorage", {
access: response.data.access,
refresh: response.data.refresh
});
})
.catch(err => {
console.log(err);
});
}
我从另一个创建并连接到baseurl的应用程序中使用的getAPI
谢谢你帮助我
您只需要将令牌添加到请求的头中
相关问题 更多 >
编程相关推荐