Guest User

Untitled

a guest
Oct 23rd, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. var SpotifyWebApi = require('spotify-web-api-node');
  2.  
  3. var scopes = ['user-read-private', 'user-read-email'],
  4. redirectUri = 'https://localhost:8888',
  5. clientId = 'f74fb79f4c824d839dd644805a09461d',
  6. state = 'some-state-of-my-choice';
  7.  
  8. var spotifyApi = new SpotifyWebApi({
  9. clientId : 'f74fb79f4c824d839dd644805a09461d',
  10. clientSecret : 'xxxxx',
  11. redirectUri : 'https://localhost:888'
  12. });
  13.  
  14. // Create the authorization URL
  15. var authorizeURL = spotifyApi.createAuthorizeURL(scopes, state);
  16. spotifyApi.setAccessToken(authorizeURL);
  17.  
  18. spotifyApi.getFollowedArtists({ limit : 10 })
  19. .then(function(data) {
  20. // 'This user is following 1051 artists!'
  21. console.log('This user is following ', data.body.artists.total, ' artists!');
  22. }, function(err) {
  23. console.log('Something went wrong!', err);
  24. });
Add Comment
Please, Sign In to add comment