JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API
https://jmperezperez.com/spotify-web-api-js/
MIT License
1.86k stars 260 forks source link

Invalid Access token #186

Closed GabrielBG0 closed 3 years ago

GabrielBG0 commented 3 years ago

Im getting an 401 invalid token when i'm trying to get a top artists.

this is my code, i'm not sure if thats the best way to do it tho: get authorization: image

get code: image

get the top artists: image

thats my first time using the library (and react) so I might have done something wrong and I'm not seeing it

Edit: I figured that I'm suppose to make a call for the /api/token endpoint first but my fetch is doing the same request twice (one returns status 200 with the token and the other returns 400 authentication invalid and overwrites the first one) is that normal?