[GH-ISSUE #688] User not approved for app / 403, code:-1 - https://api.spotify.com/v1/me/: error, reason: None #407

Closed
opened 2026-02-27 23:22:27 +03:00 by kerem · 1 comment
Owner

Originally created by @TiceWise on GitHub (Jun 9, 2021).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/688

Describe the bug
Since a recent 'Spotify for Developers'-update (see "Improving the developer and user experience for third-party apps" May 27, 2021), users need to be added in the 'Spotify for Developers'-dashboard.

I discovered the bug after a successful sign in with a different account, but the the simple 'spotify.me()' call raised the unclear error: "spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/: error, reason: None"

After diving in client.py I noticed the actual response message was b"User not approved for app". Searching further I found the news-post mentioned earlier.

Your code

spotify = spotipy.Spotify(auth_manager=auth_manager)
user = spotify.me()

Expected behavior
I think it would be better to return the "User not approved for app" as error, instead of the reason: None. Possibly even with a referral to the Spotify developer dashboard to add users.

Output

Traceback (most recent call last):
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 245, in _internal_call
    response.raise_for_status()
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/requests/models.py", line 943, 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/me/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 2088, in __call__
    return self.wsgi_app(environ, start_response)
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app
    response = self.handle_exception(e)
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 2070, in wsgi_app
    response = self.full_dispatch_request()
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 1515, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 1513, in full_dispatch_request
    rv = self.dispatch_request()
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 1499, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "/Users/***.../***/app.py", line 167, in login
    user = spotify.me()
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 1161, in me
    return self._get("me/")
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 291, in _get
    return self._internal_call("GET", url, payload, kwargs)
  File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 261, in _internal_call
    raise SpotifyException(
spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/:
 error, reason: None

Environment:

  • OS: MacOS, but also on Heroku
  • Python version 3.9.5
  • spotipy version 2.18.0
  • your IDE (if using any): Visual Studio Code

Additional context
"Improving the developer and user experience for third-party apps"

Originally created by @TiceWise on GitHub (Jun 9, 2021). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/688 **Describe the bug** Since a recent 'Spotify for Developers'-update (see "[Improving the developer and user experience for third-party apps](https://developer.spotify.com/community/news/2021/05/27/improving-the-developer-and-user-experience-for-third-party-apps/)" May 27, 2021), users need to be added in the 'Spotify for Developers'-dashboard. I discovered the bug after a successful sign in with a different account, but the the simple 'spotify.me()' call raised the unclear error: "spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/: error, reason: None" After diving in client.py I noticed the actual response message was b"User not approved for app". Searching further I found the news-post mentioned earlier. **Your code** ``` spotify = spotipy.Spotify(auth_manager=auth_manager) user = spotify.me() ``` **Expected behavior** I think it would be better to return the "User not approved for app" as error, instead of the reason: None. Possibly even with a referral to the Spotify developer dashboard to add users. **Output** ``` Traceback (most recent call last): File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 245, in _internal_call response.raise_for_status() File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/requests/models.py", line 943, 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/me/ During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 2088, in __call__ return self.wsgi_app(environ, start_response) File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 2073, in wsgi_app response = self.handle_exception(e) File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 2070, in wsgi_app response = self.full_dispatch_request() File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 1515, in full_dispatch_request rv = self.handle_user_exception(e) File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 1513, in full_dispatch_request rv = self.dispatch_request() File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/flask/app.py", line 1499, in dispatch_request return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args) File "/Users/***.../***/app.py", line 167, in login user = spotify.me() File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 1161, in me return self._get("me/") File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 291, in _get return self._internal_call("GET", url, payload, kwargs) File "/Users/***/.pyenv/versions/3.9.5/lib/python3.9/site-packages/spotipy/client.py", line 261, in _internal_call raise SpotifyException( spotipy.exceptions.SpotifyException: http status: 403, code:-1 - https://api.spotify.com/v1/me/: error, reason: None ``` **Environment:** - OS: MacOS, but also on Heroku - Python version 3.9.5 - spotipy version 2.18.0 - your IDE (if using any): Visual Studio Code **Additional context** "[Improving the developer and user experience for third-party apps](https://developer.spotify.com/community/news/2021/05/27/improving-the-developer-and-user-experience-for-third-party-apps/)"
kerem 2026-02-27 23:22:27 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@stephanebruckert commented on GitHub (Jun 26, 2021):

Fixed by @Peter-Schorn's PR, thanks. Will release soon

<!-- gh-comment-id:869059063 --> @stephanebruckert commented on GitHub (Jun 26, 2021): Fixed by @Peter-Schorn's PR, thanks. Will release soon
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#407
No description provided.