From 1bc07215b39abaa1a60e1254b086b9791ff1679f Mon Sep 17 00:00:00 2001 From: Aaron Wong Date: Sun, 28 Oct 2018 22:18:02 -0700 Subject: [PATCH] Replaced deprecated new Buffer with Buffer.from --- authorization_code/app.js | 4 ++-- client_credentials/app.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/authorization_code/app.js b/authorization_code/app.js index 9b8a6b55..3996e24e 100644 --- a/authorization_code/app.js +++ b/authorization_code/app.js @@ -81,7 +81,7 @@ app.get('/callback', function(req, res) { grant_type: 'authorization_code' }, headers: { - 'Authorization': 'Basic ' + (new Buffer(client_id + ':' + client_secret).toString('base64')) + 'Authorization': 'Basic ' + (Buffer.from(client_id + ':' + client_secret).toString('base64')) }, json: true }; @@ -125,7 +125,7 @@ app.get('/refresh_token', function(req, res) { var refresh_token = req.query.refresh_token; var authOptions = { url: 'https://accounts.spotify.com/api/token', - headers: { 'Authorization': 'Basic ' + (new Buffer(client_id + ':' + client_secret).toString('base64')) }, + headers: { 'Authorization': 'Basic ' + (Buffer.from(client_id + ':' + client_secret).toString('base64')) }, form: { grant_type: 'refresh_token', refresh_token: refresh_token diff --git a/client_credentials/app.js b/client_credentials/app.js index f6a799af..cbb1bf64 100644 --- a/client_credentials/app.js +++ b/client_credentials/app.js @@ -16,7 +16,7 @@ var client_secret = 'CLIENT_SECRET'; // Your secret var authOptions = { url: 'https://accounts.spotify.com/api/token', headers: { - 'Authorization': 'Basic ' + (new Buffer(client_id + ':' + client_secret).toString('base64')) + 'Authorization': 'Basic ' + (Buffer.from(client_id + ':' + client_secret).toString('base64')) }, form: { grant_type: 'client_credentials'