Credit Spotify

This commit is contained in:
Gabriel Augendre 2016-04-28 16:53:00 +02:00
parent 8441ac9a2a
commit 55566450cf
No known key found for this signature in database
GPG key ID: D2B6A5B41FC438B1

View file

@ -24,7 +24,8 @@ var redirect_uri = process.env.CALLBACK; // Your redirect uri
var environment = process.env.NODE_ENV || 'prod';
/**
* Generates a random string containing numbers and letters
* Generates a random string containing numbers and letters.
* From Spotify tutorial.
* @param {number} length The length of the string
* @return {string} The generated string
*/
@ -49,6 +50,9 @@ if (environment == 'prod' || environment == 'production') {
app.use(express.static(__dirname + '/public'))
.use(cookieParser());
/**
* From Spotify tutorial.
*/
app.get('/login', function (req, res) {
var state = generateRandomString(16);
@ -66,6 +70,9 @@ app.get('/login', function (req, res) {
}));
});
/**
* From Spotify tutorial.
*/
app.get('/callback', function (req, res) {
// your application requests refresh and access tokens
@ -117,6 +124,9 @@ app.get('/callback', function (req, res) {
}
});
/**
* From Spotify tutorial.
*/
app.get('/refresh_token', function (req, res) {
// requesting access token from refresh token