Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Generate Spotify client credentials
const axios = require('axios')
let CLIENT_ID="YOUR_CLIENT_ID"
let CLIENT_SECRET="YOUR_CLIENT_SECRET"
let auth = Buffer.from(`${CLIENT_ID}:${CLIENT_SECRET}`).toString('base64')
axios({
method: 'post',
url: 'https://accounts.spotify.com/api/token',
headers: {
'Authorization': `Basic ${auth}`,
'Content-Type': 'application/x-www-form-urlencoded'
},
params: {
'grant_type': 'client_credentials'
}
}).then(response => {
console.log(response.data.access_token)
}).catch(error => {
console.log(error)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.