Refresh Access Tokens

Refresh your access tokens if they have expired.

Client credential access token

Click the "Run" button to generate a new client credential access token.

Press + to interact
URL = "https://accounts.spotify.com/api/token?grant_type=client_credentials"
encoded = base64.b64encode('{{CLIENT_ID}}:{{CLIENT_SECRET}}')
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic '+encoded
}
response = requests.request("POST", URL, headers=headers).json()
print(json.dumps(response, indent=4))

Authorization code access token

Use the code below to generate an authorization code access token using a refresh token.

Press + to interact
URL = "https://accounts.spotify.com/api/token?grant_type=refresh_token&refresh_token={{REFRESH_TOKEN}}"
encoded = base64.b64encode('{{CLIENT_ID}}:{{CLIENT_SECRET}}')
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
'Authorization': 'Basic '+encoded
}
response = requests.request("POST", URL, headers=headers).json()
print(json.dumps(response, indent=4))