实例代码
const loginInfo = {
username: userInfo.username.trim(),
password: userInfo.password,
grant_type: 'password'
}
axios({
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
method: 'post',
url: 'http://localhost:7001/auth/oauth/token',
auth: {
username: 'tby-pc',
password: 'tby-secret'
},
data: Qs.stringify(loginInfo)
}).then(response => {
console.log(response.data.access_token)
console.log(response.data.token_type)
console.log(response.data.refresh_token)
}).catch(err => {
console.log(err)
reject(err)
})