I've been trying to fix this issue for a good hour, and I can't seem to fix this. I'm using node-fetch
for my requests (which is just a replica of the Fetch API for browsers, but cloned for Node). I've got the following code:
fetch("https://accounts.spotify.com/api/token", {
body: `grant_type=authorization_code&code=${req.query.code}&redirect_uri=${encodeURIComponent("http://localhost:3000/callback")}`,
headers: {
Authorization: `Basic ${btoa(my_client_id)}:${btoa(my_client_secret)}`,
"Content-Type": "application/x-www-form-urlencoded"
},
method: "POST"
})
This is supposed to take the code from the callback, and send it to Spotify for a refresh token.
Expected behaviour:Returned should be the following:
400 Bad Request (consistently)