@@ -143,15 +143,23 @@ const FacebookUtils = {
143
143
* SDK to authenticate the user, and then automatically logs in (or
144
144
* creates, in the case where it is a new user) a Parse.User.
145
145
*
146
+ * Standard API:
147
+ *
148
+ * <code>logIn(permission: string, authData: Object);</code>
149
+ *
150
+ * Advanced API: Used for handling your own oAuth tokens
151
+ * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
152
+ *
153
+ * <code>logIn(authData: Object, options?: Object);</code>
154
+ *
146
155
* @method logIn
147
156
* @name Parse.FacebookUtils.logIn
148
157
* @param {(String|Object) } permissions The permissions required for Facebook
149
158
* log in. This is a comma-separated string of permissions.
150
159
* Alternatively, supply a Facebook authData object as described in our
151
160
* REST API docs if you want to handle getting facebook auth tokens
152
161
* yourself.
153
- * @param {Object } options Standard options object with success and error
154
- * callbacks.
162
+ * @param {Object } options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
155
163
* @returns {Promise }
156
164
*/
157
165
logIn ( permissions , options ) {
@@ -163,23 +171,25 @@ const FacebookUtils = {
163
171
}
164
172
requestedPermissions = permissions ;
165
173
return ParseUser . _logInWith ( 'facebook' , options ) ;
166
- } else {
167
- const newOptions = { } ;
168
- if ( options ) {
169
- for ( const key in options ) {
170
- newOptions [ key ] = options [ key ] ;
171
- }
172
- }
173
- newOptions . authData = permissions ;
174
- return ParseUser . _logInWith ( 'facebook' , newOptions ) ;
175
174
}
175
+ const authData = { authData : permissions } ;
176
+ return ParseUser . _logInWith ( 'facebook' , authData , options ) ;
176
177
} ,
177
178
178
179
/**
179
180
* Links Facebook to an existing PFUser. This method delegates to the
180
181
* Facebook SDK to authenticate the user, and then automatically links
181
182
* the account to the Parse.User.
182
183
*
184
+ * Standard API:
185
+ *
186
+ * <code>link(user: Parse.User, permission: string, authData?: Object);</code>
187
+ *
188
+ * Advanced API: Used for handling your own oAuth tokens
189
+ * {@link https://docs.parseplatform.org/rest/guide/#linking-users}
190
+ *
191
+ * <code>link(user: Parse.User, authData: Object, options?: FullOptions);</code>
192
+ *
183
193
* @method link
184
194
* @name Parse.FacebookUtils.link
185
195
* @param {Parse.User } user User to link to Facebook. This must be the
@@ -189,8 +199,7 @@ const FacebookUtils = {
189
199
* Alternatively, supply a Facebook authData object as described in our
190
200
* REST API docs if you want to handle getting facebook auth tokens
191
201
* yourself.
192
- * @param {Object } options Standard options object with success and error
193
- * callbacks.
202
+ * @param {Object } options MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string
194
203
* @returns {Promise }
195
204
*/
196
205
link ( user , permissions , options ) {
@@ -202,16 +211,9 @@ const FacebookUtils = {
202
211
}
203
212
requestedPermissions = permissions ;
204
213
return user . _linkWith ( 'facebook' , options ) ;
205
- } else {
206
- const newOptions = { } ;
207
- if ( options ) {
208
- for ( const key in options ) {
209
- newOptions [ key ] = options [ key ] ;
210
- }
211
- }
212
- newOptions . authData = permissions ;
213
- return user . _linkWith ( 'facebook' , newOptions ) ;
214
214
}
215
+ const authData = { authData : permissions } ;
216
+ return user . _linkWith ( 'facebook' , authData , options ) ;
215
217
} ,
216
218
217
219
/**
@@ -232,6 +234,11 @@ const FacebookUtils = {
232
234
) ;
233
235
}
234
236
return user . _unlinkFrom ( 'facebook' , options ) ;
237
+ } ,
238
+
239
+ // Used for testing purposes
240
+ _getAuthProvider ( ) {
241
+ return provider ;
235
242
}
236
243
} ;
237
244
0 commit comments