let path = handler.$apiRoot.oauthsitePath + '/OAuth/Token';
let params = {
grant_type: 'password',
client_id: handler.$globalParams.client_id,
client_secret: handler.$globalParams.client_secret,
username: type,
password: open_id
}
handler.axios({
url: path,
method: 'post',
data: params,
transformRequest: [function (data) {
console.log("data");
console.log(JSON.stringify(data));
let ret = '';
for (let it in data) {
ret += encodeURIComponent(it) + '=' + encodeURIComponent(data[it]) + '&';
};
console.log("ret")
console.log(ret);
return ret;
}],
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
}
})
.then((res) => {
console.log("res");
console.log(res);
if (res.status === 200) {
console.log(200);
handler.loadingStatus = false;
/* this.vuethis.$vux.loading.hide() */
window.localStorage.setItem('accessToken', res.data.access_token);
handler.$router.push({
path: '/user/relatelogin'
})
}else {
console.log('others');
}
})
.catch((err) => {
console.log("报错信息:")
console.log(err);
handler.$router.push({
path: '/user/relatelogin'
})
});
}
报400错误
[LOG] : 报错信息:
[LOG] : Error: Request failed with status code 400
0 个回复