MCPcopy
hub / github.com/parse-community/parse-server / getMockFacebookProviderWithIdToken

Function getMockFacebookProviderWithIdToken

spec/ParseUser.spec.js:1283–1325  ·  view source on GitHub ↗
(id, token)

Source from the content-addressed store, hash-verified

1281 });
1282
1283 const getMockFacebookProviderWithIdToken = function (id, token) {
1284 return {
1285 authData: {
1286 id: id,
1287 access_token: token,
1288 expiration_date: new Date().toJSON(),
1289 },
1290 shouldError: false,
1291 loggedOut: false,
1292 synchronizedUserId: null,
1293 synchronizedAuthToken: null,
1294 synchronizedExpiration: null,
1295
1296 authenticate: function (options) {
1297 if (this.shouldError) {
1298 options.error(this, 'An error occurred');
1299 } else if (this.shouldCancel) {
1300 options.error(this, null);
1301 } else {
1302 options.success(this, this.authData);
1303 }
1304 },
1305 restoreAuthentication: function (authData) {
1306 if (!authData) {
1307 this.synchronizedUserId = null;
1308 this.synchronizedAuthToken = null;
1309 this.synchronizedExpiration = null;
1310 return true;
1311 }
1312 this.synchronizedUserId = authData.id;
1313 this.synchronizedAuthToken = authData.access_token;
1314 this.synchronizedExpiration = authData.expiration_date;
1315 return true;
1316 },
1317 getAuthType() {
1318 return 'facebook';
1319 },
1320 deauthenticate: function () {
1321 this.loggedOut = true;
1322 this.restoreAuthentication(null);
1323 },
1324 };
1325 };
1326
1327 // Note that this mocks out client-side Facebook action rather than
1328 // server-side.

Callers 2

getMockFacebookProviderFunction · 0.85
ParseUser.spec.jsFile · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected