From 1e0667dd738a51aac976137b36cb11f74edc5288 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Sat, 30 Mar 2019 17:59:25 -0500 Subject: [PATCH 1/2] Allow test credentials for Facebook Auth --- src/Adapters/Auth/facebook.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Adapters/Auth/facebook.js b/src/Adapters/Auth/facebook.js index fdd454df2e..b75e0cfc1c 100644 --- a/src/Adapters/Auth/facebook.js +++ b/src/Adapters/Auth/facebook.js @@ -7,7 +7,7 @@ function validateAuthData(authData) { return graphRequest( 'me?fields=id&access_token=' + authData.access_token ).then(data => { - if (data && data.id == authData.id) { + if ((data && data.id == authData.id) || authData.id === 'test') { return; } throw new Parse.Error( @@ -20,6 +20,9 @@ function validateAuthData(authData) { // Returns a promise that fulfills iff this app id is valid. function validateAppId(appIds, authData) { var access_token = authData.access_token; + if (access_token === 'test') { + return Promise.resolve(); + } if (!appIds.length) { throw new Parse.Error( Parse.Error.OBJECT_NOT_FOUND, From fd3912744b24fdcd42b3132af8fde28e5cb16bd9 Mon Sep 17 00:00:00 2001 From: Diamond Lewis Date: Sat, 30 Mar 2019 18:08:37 -0500 Subject: [PATCH 2/2] node_env testing --- src/Adapters/Auth/facebook.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Adapters/Auth/facebook.js b/src/Adapters/Auth/facebook.js index b75e0cfc1c..c6946dc00e 100644 --- a/src/Adapters/Auth/facebook.js +++ b/src/Adapters/Auth/facebook.js @@ -7,7 +7,10 @@ function validateAuthData(authData) { return graphRequest( 'me?fields=id&access_token=' + authData.access_token ).then(data => { - if ((data && data.id == authData.id) || authData.id === 'test') { + if ( + (data && data.id == authData.id) || + (process.env.TESTING && authData.id === 'test') + ) { return; } throw new Parse.Error( @@ -20,7 +23,7 @@ function validateAuthData(authData) { // Returns a promise that fulfills iff this app id is valid. function validateAppId(appIds, authData) { var access_token = authData.access_token; - if (access_token === 'test') { + if (process.env.TESTING && access_token === 'test') { return Promise.resolve(); } if (!appIds.length) {