HTTP Request Code 206 Spotify Server Error

Question:

I am trying to get the user authorization code for the authentication flow. When sending the get request with Python and requests I have two dictionaries for headers and params, yet I get the 206 response and server error. I have all the mandatory parameters and header fields. Ignore any indent problems, they’re just pasted wrong. There should be no problems related to my spotify dev account affecting the app/client.

headers = {
    'Accept': 'application/json',
    'Content-Type': 'application/json',
    }

    code_params = {
        'response_type': 'code',
        'client_id': CLIENT_ID,
        'redirect_uri': REDIRECT_URI,
        'scope': 'user-read-private user-read-email',
    }


    code = requests.get('https://accounts.spotify.com/authorize', params=code_params, headers=headers).json()
Asked By: Victor Zheng

||

Answers:

So, the authentication code request is supposed to redirect you to login and give permissions. Instead of calling .json() , you need to use .url and navigate to that website to get that redirect.

Answered By: Victor Zheng