Hi, I currently have a python script that creates a playlist of recently played tracks. However, it only works for my own account right now and I wanted to know how I could make this work for other users as well. I have the appropriate scopes (playlist-modify-public and user-read-recently-played) included and I am using Authorization Code Flow. When a different user logs in, it returns 403 and says "You cannot create playlists for another user". Thanks
Hey @Luks_ger, thanks for coming to the Community for help!
Sounds like an exciting project! Let's see what could be going on here. In the API call you need to specify the user-id (username) of the user you're making a playlist for.
https://api.spotify.com/v1/users/{user_id}/playlists
Could you make sure this is set as a variable and not hard-coded? Let me know if that works! 🙂
Have a good one, happy coding!
Hubo
The program gets the username as a command line argument so it's not hardcoded. It might be something with how the Spotipy python library I'm using might be implemented. I'm using two different types of API calls. One make a v1/me/ request while the other makes a v1/user/{username}/ call. I don't know if this could be the problem.
Hey @Luks_ger, thanks for getting back to me here!
Hmm, this may sound a bit odd, but could you restart your device? That could help here. Let me know how you get on!
Have a good one,
Hubo
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game…
Env: prod