I want to get a list of playlists that a user owns from Spotify.
I don't want any collaborative or shared playlist, just the playlists the user owns, and can update.
It its explained here how to get a user's playlist.
My code currently looks like this. the problem is that it returns all playlist's that the user has, inlacing ones they do not own, or share. Is there something simple i can do with the auth scope to get just the user's playlist, or do i have to loop through the result's and only put the playlist in the array if the owner matches the playlist owner?
app.get('/user-playlists', function(req, res){
var options = {
url: 'https://api.spotify.com/v1/me',
headers: {
'Authorization': 'Bearer ' + access_token
},
json: true
};
request-promise(options).then(function(body) {
var userId = body.id;
var options = {
url: 'https://api.spotify.com/v1/users/' + userId + '/playlists',
headers: {
'Authorization': 'Bearer ' + access_token
},
json: true
};
return rp(options).then(function (body) {
var playlists = body.items;
res.json(playlists);
});
}).catch(function (err) {
console.log(err)
})
});