mirror of
https://gitlab.com/deeplydrumming/DeemixFix.git
synced 2026-01-15 16:32:59 -03:00
27 lines
785 B
JavaScript
27 lines
785 B
JavaScript
const { util } = require('prettier')
|
|
const SpotifyWebApi = require('../')
|
|
|
|
/**
|
|
* This example uses the Client Credentials authorization flow.
|
|
*/
|
|
|
|
/**
|
|
* Get the credentials from Spotify's Dashboard page.
|
|
* https://developer.spotify.com/dashboard/applications
|
|
*/
|
|
const spotifyApi = new SpotifyWebApi({
|
|
clientId: '<Client ID>',
|
|
clientSecret: '<Client Secret>'
|
|
})
|
|
|
|
// Retrieve an access token using your credentials
|
|
spotifyApi.clientCredentialsGrant()
|
|
.then(function (result) {
|
|
console.log('It worked! Your access token is: ' + result.body.access_token)
|
|
}).catch(function (err) {
|
|
console.log('If this is printed, it probably means that you used invalid ' +
|
|
'clientId and clientSecret values. Please check!')
|
|
console.log('Hint: ')
|
|
console.log(err)
|
|
})
|