File tree 5 files changed +19
-4
lines changed 5 files changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ function Config(applicationId, mount) {
20
20
this . dotNetKey = cacheInfo . dotNetKey ;
21
21
this . restAPIKey = cacheInfo . restAPIKey ;
22
22
this . fileKey = cacheInfo . fileKey ;
23
+ this . facebookAppIds = cacheInfo . facebookAppIds ;
23
24
this . mount = mount ;
24
25
}
25
26
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ There is a development wiki here on GitHub: https://github.com/ParsePlatform/par
17
17
* masterKey (required) - The master key to use for overriding ACL security
18
18
* cloud - The absolute path to your cloud code main.js file
19
19
* fileKey - For migrated apps, this is necessary to provide access to files already hosted on Parse.
20
+ * facebookAppIds - An array of valid Facebook application IDs.
20
21
21
22
#### Client key options:
22
23
Original file line number Diff line number Diff line change @@ -219,7 +219,7 @@ RestWrite.prototype.handleFacebookAuthData = function() {
219
219
return facebook . validateUserId ( facebookData . id ,
220
220
facebookData . access_token )
221
221
. then ( ( ) => {
222
- return facebook . validateAppId ( process . env . FACEBOOK_APP_ID ,
222
+ return facebook . validateAppId ( this . config . facebookAppIds ,
223
223
facebookData . access_token ) ;
224
224
} ) . then ( ( ) => {
225
225
// Check if this user already exists
Original file line number Diff line number Diff line change @@ -16,10 +16,15 @@ function validateUserId(userId, access_token) {
16
16
}
17
17
18
18
// Returns a promise that fulfills iff this app id is valid.
19
- function validateAppId ( appId , access_token ) {
19
+ function validateAppId ( appIds , access_token ) {
20
+ if ( ! appIds . length ) {
21
+ throw new Parse . Error (
22
+ Parse . Error . OBJECT_NOT_FOUND ,
23
+ 'Facebook auth is not configured.' ) ;
24
+ }
20
25
return graphRequest ( 'app?access_token=' + access_token )
21
26
. then ( ( data ) => {
22
- if ( data && data . id == appId ) {
27
+ if ( data && appIds . contains ( data . id ) ) {
23
28
return ;
24
29
}
25
30
throw new Parse . Error (
Original file line number Diff line number Diff line change @@ -26,6 +26,8 @@ addParseCloud();
26
26
// "cloud": relative location to cloud code to require
27
27
// "appId": the application id to host
28
28
// "masterKey": the master key for requests to this app
29
+ // "facebookAppIds": an array of valid Facebook Application IDs, required
30
+ // if using Facebook login
29
31
// "collectionPrefix": optional prefix for database collection names
30
32
// "fileKey": optional key from Parse dashboard for supporting older files
31
33
// hosted by Parse
@@ -59,9 +61,15 @@ function ParseServer(args) {
59
61
javascriptKey : args . javascriptKey || '' ,
60
62
dotNetKey : args . dotNetKey || '' ,
61
63
restAPIKey : args . restAPIKey || '' ,
62
- fileKey : args . fileKey || 'invalid-file-key'
64
+ fileKey : args . fileKey || 'invalid-file-key' ,
65
+ facebookAppIds : args . facebookAppIds || [ ]
63
66
} ;
64
67
68
+ // To maintain compatibility. TODO: Remove in v2.1
69
+ if ( process . env . FACEBOOK_APP_ID ) {
70
+ cache . apps [ args . appId ] [ 'facebookAppIds' ] . push ( process . env . FACEBOOK_APP_ID ) ;
71
+ }
72
+
65
73
// Initialize the node client SDK automatically
66
74
Parse . initialize ( args . appId , args . javascriptKey || '' , args . masterKey ) ;
67
75
You can’t perform that action at this time.
0 commit comments