refresh token always invalid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
so, i have a personal project where i want to achieve my currently playing tracks from spotify to my website. i run it in localhost:3000/ and i set the redirect uri to localhost:3000/callback. so when i authorized my account and got the refresh token, i put it into my code, but when i ran the code it keeps telling me error 400. where the response says 'invalid grant type' and the description says 'invalid refresh token'. but i'm pretty sure the refresh token is right and newly generated. so here's the code
const token = Buffer.from(`${client_id}:${client_secret}`).toString('base64');
const accessToken = await axios({
method: 'post',
url: 'https://accounts.spotify.com/api/token',
data: `grant_type=refresh_token&refresh_token=${refresh_token}`,
headers: {
Authorization: `Basic ${token}`,
'Content-Type': 'application/x-www-form-urlencoded'
}
});
but other than refresh token, i suspect the error came from the url. everytime i opened https://accounts.spotify.com/api/token it always showing picture below.
so now i'm confused where i did wrong
Labels:
- Labels:
-
Question
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page