Double проверено client_id и client_secret, чтобы убедиться, что все в порядке.
То же самое для URL URI и токен запросы 'URL.
Я не могу обернуть голову, почему это происходит < /p>
Вот мой код < /p>
Код: Выделить всё
parameters = {
"grant_type":"authorization_code",
"code": code,
"redirect_uri":SPOTIFY_URI
}
auth_string = base64.urlsafe_b64encode(f"{SPOTIFY_ID}:{SPOTIFY_SECRET}".encode("utf-8"))
headers = {
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": f"Basic {auth_string.decode('utf-8')}",
}
response = requests.post(
"https://accounts.spotify.com/api/token", params=parameters,
headers=headers
)
response.raise_for_status()
print(response)
< /code>
И вот поднятое сообщение об ошибке: < /p>
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url:
Подробнее здесь: https://stackoverflow.com/questions/794 ... api-python