Closed Casey6624 closed 4 years ago
Hey,
1) You have to create onclick event on button or something like this,
onClick={() => window.location = "https://accounts.spotify.com/authorize?client_id=${YOUR_CLIENTID}&redirect_uri=${YOUR_REDIRECT}&scope=user-read-private%20user-read-email&response_type=token&state=123"}
2) After this, you will get access_token ( it will be in your URL ), then parse it with "query-string" e.g. By the way here is how it can look let parsed = queryString.parse(window.location.hash)
3) Do XHR request, fetch("https://api.spotify.com/v1/me/player/currently-playing", { method: 'GET', headers: { 'Authorization': 'Bearer ' + parsed.access_token } }) .then(res => res.json()) .then(data => console.log(data))
Hey! Thanks for the response, but I know how to do this and your comment refers to Auhorization Code authentication not Client Server like i requested.
I don't want a user to have to login to utilize the API, I want my server to refresh the connection and make requests on behalf of a user
This way is returning invalid user to me
Hi, is there any way we can target the https://api.spotify.com/v1/me/player/currently-playing endpoint using the client-credentials method?
We use Spotify as our music source in the office and I would like to grab the data and manipulate it...
Is this possible or do you have to use implicit_grant/ authorization_code?