【发布时间】:2018-12-10 15:42:04
【问题描述】:
我正在实现登录。我可以在 Postman 中向端点令牌发送 post 请求,但不能在 axios 中。
axios函数:
axios({
method: 'post',
url: 'http://localhost:20449/token',
headers: {
'Content-type': 'application/x-www-form-urlencoded'
},
data: {
'grant_type': 'password',
'username': user.username,
'password': user.password
}
}).then(resp => {
console.log(resp)
commit(AUTH_SUCCESS, resp)
dispatch(USER_REQUEST)
resolve(resp)
})
我得到了错误
“unsupported_grant_type”
【问题讨论】:
标签: asp.net-web-api axios restful-authentication http-token-authentication