Skip to content

Login with Facebook

Backendless integrates with Facebook to support user authentication and login into a Backendless application with a Facebook account. Using the integration application developer can provide a way to skip the application registration step and allow users to use their Facebook identity to register with and experience the application.

In order to integrate Facebook login with Backendless, client application must use the Facebook SDK to authenticate the user and then makes a Backendless API call to link the Facebook identity to a BackendlessUser instance.

Property Mapping

Backendless User objects may have their own set of user properties. As a result, when a user logs in using their Facebook account, their Facebook Graph API user fields are mapped to the Backendless user properties via "property mapping". There may be multiple mapping, each must reference  a Facebook user field and a name of a Backendless property. Once a user is authenticated, Backendless obtains the field values from the Facebook user graph object and populates the mapped properties in the BackendlessUser object. For the very first login, Backendless also creates the user in its internal system.

Backendless Configuration

A Backendless application (the server side) must be configured with Facebook's application App ID and secret key. See the "Social Settings" chapter of the user guide (the Manage section) for detailed instructions for configuring Backendless with Facebook.

Integration API

The API provides a way to "exchange" Facebook access token for Backendless user object which represents the corresponding Facebook user. Before using the API, application must perform login to Facebook using its SDK. The integration process consists of the following steps:





Argument                Description
<application-id> the ID of your application generated upon its creation. You can obtain the value in the Manage > App Settings section of the Backendless Console.
<REST-api-key> REST API key of your application. You can obtain the value in the Manage > App Settings section of the Backendless Console.

Request Body

  "accessToken" : value,  
  "fieldsMapping" :  
      "first_name" : "FirstName",  
      "last_name" : "LastName"  


Argument                Description
accessToken Access token received from the Facebook SDK authentication request. This is a required value.
fieldsMapping an optional mapping between the Facebook fields and Backendless user properties. Keys must be the names of the Facebook fields, values - the names of the Backendless properties. The Facebook keys correspond to the Facebook Graph API keys. Social properties will be copied to the Backendless user properties and should be updated manually in case of their change.

Response Body

a JSON representation of a BackendlessUser object.


Login request with field mappings:

curl \  
-H 'Content-Type: application/json' \  
-X POST \  
-d'{"accessToken" : "CAANVVCKZA1Y0BAA4Z....", "fieldsMapping":{"first_name":"First", "last_name":"Last", "email":"email", "name":"name"}}' \  

Login response:

true,"Last":"Bond","name":"James Bond","___class":"Users","First":"Bond","user-token":