diff --git a/.gitignore b/.gitignore index c2658d7d..c5069bfa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ node_modules/ +package-lock.json +credentials.json \ No newline at end of file diff --git a/authorization_code/app.js b/authorization_code/app.js index 9b8a6b55..b7acdfbe 100644 --- a/authorization_code/app.js +++ b/authorization_code/app.js @@ -12,10 +12,11 @@ var request = require('request'); // "Request" library var cors = require('cors'); var querystring = require('querystring'); var cookieParser = require('cookie-parser'); +var credJson = require("../credentials.json"); -var client_id = 'CLIENT_ID'; // Your client id -var client_secret = 'CLIENT_SECRET'; // Your secret -var redirect_uri = 'REDIRECT_URI'; // Your redirect uri +var client_id = credJson['client-id']; // Your client id +var client_secret = credJson['client-secret']; // Your secret +var redirect_uri = credJson['callback-uri']; // Your redirect uri /** * Generates a random string containing numbers and letters diff --git a/client_credentials/app.js b/client_credentials/app.js index f6a799af..c478bdf4 100644 --- a/client_credentials/app.js +++ b/client_credentials/app.js @@ -8,9 +8,10 @@ */ var request = require('request'); // "Request" library +var credJson = require("../credentials.json"); -var client_id = 'CLIENT_ID'; // Your client id -var client_secret = 'CLIENT_SECRET'; // Your secret +var client_id = credJson["client-id"]; // Your client id +var client_secret = credJson["client-secret"]; // Your secret // your application requests authorization var authOptions = { @@ -30,7 +31,7 @@ request.post(authOptions, function(error, response, body) { // use the access token to access the Spotify Web API var token = body.access_token; var options = { - url: 'https://api.spotify.com/v1/users/jmperezperez', + url: 'https://api.spotify.com/v1/users/menefee7463', headers: { 'Authorization': 'Bearer ' + token }, diff --git a/package.json b/package.json index b40a74ce..25159dfe 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,10 @@ "description": "Basic examples of the Spotify authorization flows through OAuth 2", "version": "0.0.2", "dependencies": { - "cookie-parser": "1.3.2", + "cookie-parser": "1.4.5", "express": "~4.16.0", "cors": "^2.8.4", "querystring": "~0.2.0", - "request": "~2.83.0" + "request": "~2.88.0" } }