<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Authentication Error when trying to create new playlist on my own account in Spotify for Developers</title>
    <link>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/7025175#M18306</link>
    <description>&lt;P&gt;Hi &lt;a href="https://community.spotify.com/t5/user/viewprofilepage/user-id/26885599"&gt;@tmmls1977&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the Authorization Code flow, with or without PKCE. The Implicit grant is deprecated.&lt;/P&gt;</description>
    <pubDate>Fri, 27 Jun 2025 12:07:28 GMT</pubDate>
    <dc:creator>Ximzend</dc:creator>
    <dc:date>2025-06-27T12:07:28Z</dc:date>
    <item>
      <title>Authentication Error when trying to create new playlist on my own account</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/5470746#M7308</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Plan&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Premium&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Country: USA&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Device&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(Macbook Pro 1st Gen M1)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Operating System&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;(MacOS Ventura 13.0.1)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;My Question or Issue&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;I am trying to write a python script that just scrapes other users' playlists and adds songs in them to my own playlist. When running the following script:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import spotipy
from spotipy.oauth2 import SpotifyClientCredentials

# Set your Spotify API credentials
client_id = "my_client_id"
client_secret = "my_client_secret"
scopes = ["user-playlist-create", "user-playlist-modify"]

# Authenticate with the Spotify API
client_credentials_manager = SpotifyClientCredentials(client_id=client_id, client_secret=client_secret)
sp = spotipy.Spotify(client_credentials_manager=client_credentials_manager)

# Define the name and description of your playlist
playlist_name = "new_playlist"
playlist_description = "a new playlist built from other users' playlists"

# Create the playlist on your Spotify account
playlist = sp.user_playlist_create(user="spiritkhakis", name=playlist_name, description=playlist_description)
playlist_id = playlist["id"]


# Add songs from other users' playlists to your playlist
songs = []
for user in ["user1", "user2", "user3"]:
    playlists = sp.user_playlists(user=user)
    for playlist in playlists["items"]:
        if playlist["name"] == "Your Top Songs 2022":
            playlist_tracks = sp.playlist_tracks(playlist_id=playlist["id"])
            for track in playlist_tracks["items"]:
                songs.append(track["track"]["id"])

# Add the songs to your playlist
sp.user_playlist_add_tracks(user="spiritkhakis", playlist_id=playlist_id, tracks=songs)

# Print a message to confirm that the playlist has been created
print(f"Successfully created playlist: {playlist_name}")


# Print a message to confirm that the playlist has been created
print(f"Successfully created playlist: {playlist_name}")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;I receive the following error message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;Couldn't read cache at: .cache
Couldn't write token to cache at: .cache
HTTP Error for POST to https://api.spotify.com/v1/users/spiritkhakis/playlists with Params: {} returned 403 due to This request requires user authentication.
Traceback (most recent call last):
  File "/Users/grayson/master/lib/python3.9/site-packages/spotipy/client.py", line 245, in _internal_call
    response.raise_for_status()
  File "/Users/grayson/master/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.spotify.com/v1/users/spiritkhakis/playlists

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/grayson/master/playlist.py", line 18, in &amp;lt;module&amp;gt;
    playlist = sp.user_playlist_create(user="spiritkhakis", name=playlist_name, description=playlist_description)
  File "/Users/grayson/master/lib/python3.9/site-packages/spotipy/client.py", line 792, in user_playlist_create
    return self._post("users/%s/playlists" % (user,), payload=data)
  File "/Users/grayson/master/lib/python3.9/site-packages/spotipy/client.py", line 302, in _post
    return self._internal_call("POST", url, payload, kwargs)
  File "/Users/grayson/master/lib/python3.9/site-packages/spotipy/client.py", line 267, in _internal_call
    raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/users/spiritkhakis/playlists:
 This request requires user authentication., reason: None&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Not sure what is causing this, since I'm pretty sure I have authenticated the user in question (spiritkhakis is my own account, and the account with which I have registered the app). I saw one forum post saying I needed to navigate specifically to an "Authenticate a New User" option under the "Dashboard" tab on the Spotify Developer website, but when I navigate to my dashboard, there is no such option.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;All help is appreciated. Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 03:12:12 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/5470746#M7308</guid>
      <dc:creator>spiritkhakis</dc:creator>
      <dc:date>2022-12-09T03:12:12Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication Error when trying to create new playlist on my own account</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/5470808#M7311</link>
      <description>&lt;P&gt;If you want to use user_playlist_create(), you can't use Client Credentials. You can read this at the bottom of the error message: "This request requires user authentication.". You can &lt;A href="https://github.com/spotipy-dev/spotipy#with-user-authentication" target="_blank" rel="noopener"&gt;read here how to use User Authentication&lt;/A&gt; inside your script. You need to use the &lt;A href="https://developer.spotify.com/documentation/general/guides/authorization/scopes/" target="_blank" rel="noopener"&gt;Scopes&lt;/A&gt;&lt;SPAN&gt;: playlist-read-private, playlist-read-collaborative,&amp;nbsp;playlist-modify-private, playlist-modify-public.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;At the top, there's an error message saying "Couldn't write token to cache at: .cache". Maybe it has something to do with the other message, or you are running your script from somewhere Python doesn't have read/write access.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2022 08:13:18 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/5470808#M7311</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2022-12-09T08:13:18Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication Error when trying to create new playlist on my own account</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/7025143#M18304</link>
      <description>&lt;P&gt;Can all other authentications be used when creating playlists?&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 11:43:58 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/7025143#M18304</guid>
      <dc:creator>tmmls1977</dc:creator>
      <dc:date>2025-06-27T11:43:58Z</dc:date>
    </item>
    <item>
      <title>Re: Authentication Error when trying to create new playlist on my own account</title>
      <link>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/7025175#M18306</link>
      <description>&lt;P&gt;Hi &lt;a href="https://community.spotify.com/t5/user/viewprofilepage/user-id/26885599"&gt;@tmmls1977&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can use the Authorization Code flow, with or without PKCE. The Implicit grant is deprecated.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Jun 2025 12:07:28 GMT</pubDate>
      <guid>https://community.spotify.com/t5/Spotify-for-Developers/Authentication-Error-when-trying-to-create-new-playlist-on-my/m-p/7025175#M18306</guid>
      <dc:creator>Ximzend</dc:creator>
      <dc:date>2025-06-27T12:07:28Z</dc:date>
    </item>
  </channel>
</rss>

