From b8c04305daf83928231403e7e3fc3854511ac035 Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Wed, 15 Jul 2020 00:41:52 +0000 Subject: [PATCH 1/4] fix: upgrade cookie-parser from 1.3.2 to 1.4.5 Snyk has created this PR to upgrade cookie-parser from 1.3.2 to 1.4.5. See this package in NPM: https://www.npmjs.com/package/cookie-parser See this project in Snyk: https://app.snyk.io/org/security-jcj/project/616eb237-9d91-42cc-a48b-99635c260be6?utm_source=github&utm_medium=upgrade-pr --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b40a74ce..7f11bab0 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "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", From 67aa6c1122a9b3471c8453cf965b59d2f971367e Mon Sep 17 00:00:00 2001 From: snyk-bot Date: Fri, 17 Jul 2020 00:42:03 +0000 Subject: [PATCH 2/4] fix: package.json to reduce vulnerabilities The following vulnerabilities are fixed with an upgrade: - https://snyk.io/vuln/SNYK-JS-AJV-584908 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b40a74ce..c7e3386b 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,6 @@ "express": "~4.16.0", "cors": "^2.8.4", "querystring": "~0.2.0", - "request": "~2.83.0" + "request": "~2.88.0" } } From caf20da3dd674f1ddebf623ec8218e1566edc923 Mon Sep 17 00:00:00 2001 From: menef0124 Date: Thu, 24 Jun 2021 09:35:28 -0500 Subject: [PATCH 3/4] Initial commit --- .gitignore | 2 ++ authorization_code/app.js | 7 ++++--- client_credentials/app.js | 7 ++++--- 3 files changed, 10 insertions(+), 6 deletions(-) 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..44b312c0 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/menef7463', headers: { 'Authorization': 'Bearer ' + token }, From 1cb353d6f145e1ddd3e26f49c21749c63cae5057 Mon Sep 17 00:00:00 2001 From: menef0124 Date: Mon, 28 Jun 2021 08:34:21 -0500 Subject: [PATCH 4/4] Small changes --- client_credentials/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client_credentials/app.js b/client_credentials/app.js index 44b312c0..c478bdf4 100644 --- a/client_credentials/app.js +++ b/client_credentials/app.js @@ -31,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/menef7463', + url: 'https://api.spotify.com/v1/users/menefee7463', headers: { 'Authorization': 'Bearer ' + token },