Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

401 No token provided

401 No token provided

I want to get as a JSON file the contents of my Spotify library, mainly liked songs and playlists. Spotify's web API provides that, but I am not experienced with web applications.

However I am experienced with Python, and I try to implement what the Spotify for Developers Documentation on the site suggests with Python.

Firstly, I have to request for an Access token which is used in every HTTP request. I follow the instructions here, and in Request User Authentication section, the GET request that I do for getting the callback responds with

 

'{ "error": { "status": 401, "message": "No token provided" } }'

 

If I understand correctly, I need the response of this request, in order to get the access token. My code is this:

 

import requests


uri_redirect = 'http://localhost:8888/callback'
authorize_endpoint = 'https://api.spotify.com/authorize'
request_authorization_parameters = {'client_id': 'here I give my client id',
                                                                   'response_type': 'code',
                                                                   'redirect_uri': uri_redirect,
                                                                    'scope': 'user-library-read playlist-read-private'}
r_auth = requests.get(authorize_endpoint, params=request_authorization_parameters)

 

What am I missing?

 

Cheers!

Reply
2 Replies

After all, it was a careless mistake. I used wrong URL for the authorization endpoint.

 

The request must be sent to https://accounts.spotify.com/authorize instead of https://api.spotify.com/authorize

 

Following the rest of the documentation, I had no problem.

this link... https://accounts.spotify.com/authorize does not work... its usually show Missing required parameter: client_id ...

while the ... https://accounts.spotify.com/authorize show no token provided.. how is that possible...

Suggested posts

Let's introduce ourselves!

Hey there you,   Yeah, you! 😁   Welcome - we're glad you joined the Spotify Community!   While you here, let's have a fun game and get…

ModeratorStaff / Moderator/ 4 years ago  in Social & Random