FacebookUtils

Parse. FacebookUtils

new FacebookUtils()

Provides a set of utilities for using Parse with Facebook.

Methods

(static) init(options)

Initializes Parse Facebook integration. Call this function after you have loaded the Facebook Javascript SDK with the same parameters as you would pass to FB.init(). Parse.FacebookUtils will invoke FB.init() for you with these arguments.

Parameters:
Name Type Description
options object

Facebook options argument as described here: FB.init(). The status flag will be coerced to 'false' because it interferes with Parse Facebook integration. Call FB.getLoginStatus() explicitly if this behavior is required by your application.

(static) isLinked(user) → {boolean}

Gets whether the user has their account linked to Facebook.

Parameters:
Name Type Description
user Parse.User

User to check for a facebook link. The user must be logged in on this device.

Returns:
Type:
boolean

true if the user has their account linked to Facebook.

Links Facebook to an existing PFUser. This method delegates to the Facebook SDK to authenticate the user, and then automatically links the account to the Parse.User.

Standard API:

link(user: Parse.User, permission: string, authData?: Object);

Advanced API: Used for handling your own oAuth tokens https://docs.parseplatform.org/rest/guide/#linking-users

link(user: Parse.User, authData: Object, options?: FullOptions);

Parameters:
Name Type Description
user Parse.User

User to link to Facebook. This must be the current user.

permissions string | object

The permissions required for Facebook log in. This is a comma-separated string of permissions. Alternatively, supply a Facebook authData object as described in our REST API docs if you want to handle getting facebook auth tokens yourself.

options object

MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string

Returns:
Type:
Promise

(static) logIn(permissions, options) → {Promise}

Logs in a user using Facebook. This method delegates to the Facebook SDK to authenticate the user, and then automatically logs in (or creates, in the case where it is a new user) a Parse.User.

Standard API:

logIn(permission: string, authData: Object);

Advanced API: Used for handling your own oAuth tokens https://docs.parseplatform.org/rest/guide/#linking-users

logIn(authData: Object, options?: Object);

Parameters:
Name Type Description
permissions string | object

The permissions required for Facebook log in. This is a comma-separated string of permissions. Alternatively, supply a Facebook authData object as described in our REST API docs if you want to handle getting facebook auth tokens yourself.

options object

MasterKey / SessionToken. Alternatively can be used for authData if permissions is a string

Returns:
Type:
Promise

Unlinks the Parse.User from a Facebook account.

Parameters:
Name Type Description
user Parse.User

User to unlink from Facebook. This must be the current user.

options object

Standard options object with success and error callbacks.

Returns:
Type:
Promise