Created
June 15, 2017 14:31
-
-
Save iamhunter/e6acf65c73c7e21a7b203c1275958e32 to your computer and use it in GitHub Desktop.
Spotify setup part 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The code that's returned as a query parameter to the redirect URI | |
var code = ''; | |
// Retrieve an access token and a refresh token | |
spotifyApi.authorizationCodeGrant(code) | |
.then(function(data) { | |
console.log('The token expires in ' + data.body['expires_in']); | |
console.log('The access token is ' + data.body['access_token']); | |
console.log('The refresh token is ' + data.body['refresh_token']); | |
// Set the access token on the API object to use it in later calls | |
spotifyApi.setAccessToken(data.body['access_token']); | |
spotifyApi.setRefreshToken(data.body['refresh_token']); | |
}, function(err) { | |
console.log('Something went wrong!', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment