Spotify API - Retrieving Valid Access Token in Google Apps Scripts Spotify API - Retrieving Valid Access Token in Google Apps Scripts json json

Spotify API - Retrieving Valid Access Token in Google Apps Scripts


I modified your script for retrieving access token by following curl -X "POST" -H "Authorization: Basic ZjM4ZjAw...WY0MzE=" -d grant_type=client_credentials https://accounts.spotify.com/api/token of the document. Can you please try this modified script?

var authorization = "Basic "+ Utilities.base64Encode('<client_id>:<client_secret>');var fetchParams = {  method: 'post', // Modified  payload: {'grant_type': 'client_credentials'}, // Modified  headers: {'Authorization': authorization},  muteHttpExceptions: true}var replaceResponse = UrlFetchApp.fetch("https://accounts.spotify.com/api/token", fetchParams); // ModifiedLogger.log(replaceResponse.getContentText())

Reference :

If the response message was changed, please tell me.