[GH-ISSUE #541] 403 error Restriction Violated but I have Premium #327

Closed
opened 2026-02-27 23:22:01 +03:00 by kerem · 4 comments
Owner

Originally created by @Esamanoaz on GitHub (Jul 13, 2020).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/541

Describe the bug
I am getting the 403 error whenever I try to start playback on a Spotify device. This is usually when the user does not have Premium (I think). I have Premium and have double-checked multiple times. The authorization works fine.

Your code
https://pastebin.com/fha4Rbdh

Expected behavior

  • Read Spotify album URI from an NFC tag
  • Start playback of that album on a Spotify device (my Google Home Mini)

Actual behavior

  • Reads Spotify album URI from an NFC tag
  • Attempts to start playback on Spotify device
  • Fails with 403 error

Output
https://pastebin.com/Ejizn084

Environment:

  • OS: Raspberry Pi 3
  • Python version 3.5.3
  • spotipy version 2.13.0

Additional context
My code worked on Windows 10, then after being transferred to my pi it has no longer worked.
I thought it was not authorizing correctly (it wasn't) so I fixed that, but I am still getting this same error.

I think this error might have something to do with the scope I am using, which is:
_scope = 'streaming user-read-playback-state user-modify-playback-state'

Please help!

Originally created by @Esamanoaz on GitHub (Jul 13, 2020). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/541 **Describe the bug** I am getting the 403 error whenever I try to start playback on a Spotify device. This is usually when the user does not have Premium (I think). I have Premium and have double-checked multiple times. The authorization works fine. **Your code** https://pastebin.com/fha4Rbdh **Expected behavior** - Read Spotify album URI from an NFC tag - Start playback of that album on a Spotify device (my Google Home Mini) **Actual behavior** - Reads Spotify album URI from an NFC tag - Attempts to start playback on Spotify device - Fails with 403 error **Output** https://pastebin.com/Ejizn084 **Environment:** - OS: Raspberry Pi 3 - Python version 3.5.3 - spotipy version 2.13.0 **Additional context** My code worked on Windows 10, then after being transferred to my pi it has no longer worked. I thought it was not authorizing correctly (it wasn't) so I fixed that, but I am still getting this same error. I think this error might have something to do with the scope I am using, which is: `_scope = 'streaming user-read-playback-state user-modify-playback-state'` Please help!
kerem 2026-02-27 23:22:01 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Esamanoaz commented on GitHub (Jul 17, 2020):

I printed the reason (Spotify's reasons for player errors here: link), but it is UNKNOWN. I don't know where to go from here.

<!-- gh-comment-id:660357124 --> @Esamanoaz commented on GitHub (Jul 17, 2020): I printed the reason (Spotify's reasons for player errors here: [link](https://developer.spotify.com/documentation/web-api/reference/object-model/#player-error-reasons)), but it is `UNKNOWN`. I don't know where to go from here.
Author
Owner

@stephanebruckert commented on GitHub (Aug 29, 2020):

Strange that you get UNKNOWN.

Did you also double-check that you are running the correct user (with premium)? using sp.me(). Sometimes it can use a pre-existing token and even if you specify a different username, it won't open the sign in page again. Also make sure you explicitely request to open the sign in page again, by adding show_dialog=True to SpotifyOAuth.

If you still have problems, would be good to get a minimal working example so that we can test this more easily on our side, cheers.

<!-- gh-comment-id:683284511 --> @stephanebruckert commented on GitHub (Aug 29, 2020): Strange that you get `UNKNOWN`. Did you also double-check that you are running the correct user (with premium)? using `sp.me()`. Sometimes it can use a pre-existing token and even if you specify a different `username`, it won't open the sign in page again. Also make sure you explicitely request to open the sign in page again, by adding `show_dialog=True` to `SpotifyOAuth`. If you still have problems, would be good to get a minimal working example so that we can test this more easily on our side, cheers.
Author
Owner

@Esamanoaz commented on GitHub (Sep 12, 2020):

I have done lots of tinkering in the past few months and today I found a solution. I was able to play songs via the uris parameter, but not the context_uri parameter. This means I can create a list of the track uris from the album and play that, but I would still like to use the context_uri parameter for the sake of convenience. I haven't tested yet, but I am going to assume that since albums don't work for playback, playlists won't either since they both use context_uri. Doing the same for playlists that have 100+ songs and have songs added and removed often will quickly become an annoyance.

I am very sure that this issue is on Spotify's end. Do you have any ides on how to submit a bug report or fix this?

<!-- gh-comment-id:691570239 --> @Esamanoaz commented on GitHub (Sep 12, 2020): I have done lots of tinkering in the past few months and today I found a solution. I was able to play songs via the `uris` parameter, but not the `context_uri` parameter. This means I can create a list of the track uris from the album and play that, but I would still like to use the `context_uri` parameter for the sake of convenience. I haven't tested yet, but I am going to assume that since albums don't work for playback, playlists won't either since they both use `context_uri`. Doing the same for playlists that have 100+ songs and have songs added and removed often will quickly become an annoyance. I am very sure that this issue is on Spotify's end. Do you have any ides on how to submit a bug report or fix this?
Author
Owner

@stephanebruckert commented on GitHub (Sep 13, 2020):

I am very sure that this issue is on Spotify's end. Do you have any ides on how to submit a bug report or fix this?

https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer

<!-- gh-comment-id:691579678 --> @stephanebruckert commented on GitHub (Sep 13, 2020): > I am very sure that this issue is on Spotify's end. Do you have any ides on how to submit a bug report or fix this? https://community.spotify.com/t5/Spotify-for-Developers/bd-p/Spotify_Developer
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#327
No description provided.