This commit is contained in:
Chris Ham
2018-11-14 09:05:45 -08:00
parent 6e36e06ce9
commit 51f417b916
5 changed files with 249 additions and 1 deletions

19
spotify-auth-url.js Executable file
View File

@@ -0,0 +1,19 @@
var SpotifyWebApi = require('spotify-web-api-node');
let config = require('./config.json');
var scopes = ['streaming', 'app-remote-control', 'user-read-currently-playing', 'user-read-playback-state', 'user-modify-playback-state', 'user-read-recently-played', 'playlist-read-collaborative', 'playlist-modify-private', 'playlist-modify-public', 'playlist-read-private'],
redirectUri = 'http://forevergrind.fm/spotify',
clientId = config.spotify.clientId,
state = 'some-state-of-my-choice';
// Setting credentials can be done in the wrapper's constructor, or using the API object's setters.
var spotifyApi = new SpotifyWebApi({
redirectUri: redirectUri,
clientId: clientId
});
// Create the authorization URL
var authorizeURL = spotifyApi.createAuthorizeURL(scopes, state);
// https://accounts.spotify.com:443/authorize?client_id=5fe01282e44241328a84e7c5cc169165&response_type=code&redirect_uri=https://example.com/callback&scope=user-read-private%20user-read-email&state=some-state-of-my-choice
console.log(authorizeURL);