Allow test credentials for Facebook Auth (#5466)
* Allow test credentials for Facebook Auth * node_env testing
This commit is contained in:
@@ -7,7 +7,10 @@ function validateAuthData(authData) {
|
|||||||
return graphRequest(
|
return graphRequest(
|
||||||
'me?fields=id&access_token=' + authData.access_token
|
'me?fields=id&access_token=' + authData.access_token
|
||||||
).then(data => {
|
).then(data => {
|
||||||
if (data && data.id == authData.id) {
|
if (
|
||||||
|
(data && data.id == authData.id) ||
|
||||||
|
(process.env.TESTING && authData.id === 'test')
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
throw new Parse.Error(
|
throw new Parse.Error(
|
||||||
@@ -20,6 +23,9 @@ function validateAuthData(authData) {
|
|||||||
// Returns a promise that fulfills iff this app id is valid.
|
// Returns a promise that fulfills iff this app id is valid.
|
||||||
function validateAppId(appIds, authData) {
|
function validateAppId(appIds, authData) {
|
||||||
var access_token = authData.access_token;
|
var access_token = authData.access_token;
|
||||||
|
if (process.env.TESTING && access_token === 'test') {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
if (!appIds.length) {
|
if (!appIds.length) {
|
||||||
throw new Parse.Error(
|
throw new Parse.Error(
|
||||||
Parse.Error.OBJECT_NOT_FOUND,
|
Parse.Error.OBJECT_NOT_FOUND,
|
||||||
|
|||||||
Reference in New Issue
Block a user