Skip to content

Commit

Permalink
Allow test credentials for Facebook Auth (#5466)
Browse files Browse the repository at this point in the history
* Allow test credentials for Facebook Auth

* node_env testing
  • Loading branch information
dplewis authored Mar 30, 2019
1 parent edf5b51 commit 730f5c5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/Adapters/Auth/facebook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
if (
(data && data.id == authData.id) ||
(process.env.TESTING && authData.id === 'test')
) {
return;
}
throw new Parse.Error(
Expand All @@ -20,6 +23,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 (process.env.TESTING && access_token === 'test') {
return Promise.resolve();
}
if (!appIds.length) {
throw new Parse.Error(
Parse.Error.OBJECT_NOT_FOUND,
Expand Down

0 comments on commit 730f5c5

Please sign in to comment.