JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API

Home Page:https://jmperezperez.com/spotify-web-api-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Invalid Access token

GabrielBG0 opened this issue · comments

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?