var a_token = uni.getStorageSync('access_token');
console.log(a_token);
var headers={
"Authorization":"bearer "+a_token,
"Content-Type":"application/json"
};
uni.request({
url: '/api/login',
method: 'POST',
dataType:'json',
header:headers,
data:{
"acount":acount,
"password":password
},
success: (res) => {
console.log(res);
if(res.data.success){
uni.switchTab({
url: '/pages/main/main'
});
}
},
1***@qq.com
- 发布:2019-11-05 10:02
- 更新:2020-04-20 17:51
- 阅读:3945
uniapp请求接口时,一直报错401
分类:uni-app
2 个回复
慢慢慢慢6666 - 慢慢、
请问解决了吗?
优优易招 - 优优易招
a_token过期失效
1***@qq.com
token没有过期还是返回401是什么原因
2022-11-07 19:26