- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Plan
Free/Premium
Country
Germany
Operating System
Windows 10
My Question or Issue
Hello everyone,
I have a small issue again 🙂 When I make API requests to perform certain actions (such as adding songs to the queue, pausing/resuming playback, setting volume, or skipping songs).
(I'm using the Authorization Code flow.)
The way I generate the Code:
[URL] https://accounts.spotify.com/de/authorize?response_type=token&client_id=..&scope=user-read-currently...
The way I generate/refresh Tokens:
const requestBody = new URLSearchParams();
requestBody.append('grant_type', 'authorization_code');
requestBody.append('code', Code);
requestBody.append('redirect_uri', 'http://localhost');
requestBody.append('client_id', SpoClientID);
requestBody.append('client_secret', SpoClientSecret);
try {
const response = await axios.post(TOKENendpoint, requestBody, {
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
},
});
Refreshing Tokens:
axios.post(TOKENendpoint, null, {
params: {
grant_type: 'refresh_token',
refresh_token: `${SpotifyRefreshToken}`
},
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
Authorization: `Basic ${authString}`
},
})
I'm grateful for any help. Have a wonderful day and stay healthy 🙂
Solved! Go to Solution.
- Labels:
-
Question
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page