I'm trying to use the Spotify web API via this node module to create a playlist programmatically. if I understand that to make changes to a user's playlist I have to follow the OAuth flow and get the permission first, then get a token from Spotify through the auth mechanism. In my case, I'm only trying to create Playlist in my own account programmatically. Is there an easier way to either circumvent this mechanism? or just get that auth code without having to setup an endpoint and such?
For Instance
var spotifyApi = new SpotifyWebApi({
clientId : '<insert client id>',
clientSecret : '<insert client secret>',
});
// Retrieve an access token
spotifyApi.clientCredentialsGrant()
.then(function(data) {
console.log('The access token expires in ' + data.body['expires_in']);
console.log('The access token is ' + data.body['access_token']);
// Save the access token so that it's used in future calls
spotifyApi.setAccessToken(data.body['access_token']);
spotifyApi.createPlaylist('thelinmichael', 'My Cool Playlist',{ 'public' : false })
.then(function(data) {
console.log('Created playlist!');
}, function(err) {
console.log('Something went wrong!', err);
});
}, function(err) {
console.log('Something went wrong when retrieving an access token', err.message);
});
This does not work. tells me permission denied
via user379468
No comments:
Post a Comment