我试图从LinkedIn API检索用户信息,调用api.linkedin.com/me
并在axios中发送令牌。但我得到404错误 - https://gyazo.com/b08b3eba1cbfd5809ede994b1af67fb5
我能够从他们的API获取访问令牌,但我坚持获取用户信息
在我得到一个令牌后,这是一块我称之为api.linkedin.com/me
:
.then(function (response) {
axios.get('https://api.linkedin.com/me', {
headers: {
Authorization: 'Bearer ' + response.data.access_token
}
}).then(function (response) {
console.log(response)
})
})
.catch(error => {console.log(error)})
}
我需要能够获取用户的数据,但我无法提出有效请求
先感谢您!
将get
URL更改为https://api.linkedin.com/v2/me
应该可以解决问题。
我这样说是因为https://api.linkedin.com/me
重定向到了关于linkedin的404页面,然而,https://api.linkedin.com/v2/me
返回json
回复。