Javascript 无法获取用户';Spotify API的顶级艺术家和曲目

Javascript 无法获取用户';Spotify API的顶级艺术家和曲目,javascript,json,reactjs,spotify,fetch-api,Javascript,Json,Reactjs,Spotify,Fetch Api,正在学习Spotify API,并且能够通过react访问除此之外的所有端点。这是我在(不正确的)解决方案中留下的代码 fetch('https://api.spotify.com/v1/me/top/artists', { headers: { Authorization: 'Bearer ' + accessToken }, }) .then(response => response.json()) .then(data => console.log(data.ite

正在学习Spotify API,并且能够通过react访问除此之外的所有端点。这是我在(不正确的)解决方案中留下的代码

fetch('https://api.spotify.com/v1/me/top/artists', {
  headers: { Authorization: 'Bearer ' + accessToken },
})
  .then(response => response.json())
  .then(data => console.log(data.items));

这是在我的React应用程序的componentDidMount方法中。有什么想法,我应该采取其他方法来让它正常工作吗?提前谢谢。

是否有错误消息?否,我没有收到任何信息表明提取成功或不成功。但我也不相信它会返回任何数据。你检查过你的网络请求吗?