How to create new playlist on my Spotify account using another user's Authentication key through terminal?

1.8k views Asked by At

I tried to create a new playlist for a user different user on Spotify using my developer account's credentials (used the authentication key which was generated by using developer's ID as the owner ID). But it didn't work and displayed the following error message. error message: "You cannot create a playlist for another user."

I want to know the way of creating new playlist on one account using another account's credentials.

I want my users to be able to work with spotify playlists using my application.

Thank you.

1

There are 1 answers

0
Michael Thelin On

As you've already quoted:

"You cannot create a playlist for another user."

The access token used when making a Create a Playlist request needs to be authorized by the user for whom you're creating the playlist. Otherwise, any application could create a playlists on users' behalf without their explicit permission.

This doesn't stop your application from creating playlists for other users though, but you'll need to use either the Authorization Code flow or the Implicit Grant flow to get the access token. (Access tokens retrieved through the Client Credentials flow isn't tied to any specific user.) These flows are part of the oAuth 2.0 standard and there are lots of documentation out there to read more about them. Please see Spotify's Authorization Guide for a guide that's specific to Spotify. Code examples for these flows are also available on Github.