Credit Spotify
This commit is contained in:
parent
8441ac9a2a
commit
55566450cf
1 changed files with 11 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue