OAuth2 operations are performed against the following OAuth2 endpoints requesting "public_profile" and "email" privileges:
- Authorization: https://www.facebook.com/dialog/oauth
- User details acquisition: https://graph.facebook.com/v2.2/me
Parameters
As well as the parameters described in Base Provider Parameters, the following must be set in the params object.
Name | Type | Description |
---|---|---|
appId | String, required | Your App ID from Facebook |
secret | String, required | Your App Secret key from Facebook |
User Profile Data
We request the following information from Facebook about a user. The properties are automatically mapped to the Authentication Worker's UserProfile class. These properties are then mapped to actual fields in a site user's profile, following the mappings set up in the
Facebook Property | Mapped To | Description |
---|---|---|
id | UNIQUEID | Facebook's unique user identifier |
N/A | TITLE | Not supplied by Facebook |
first_name + middle_name | FORENAMES | Forename, plus middle names (if supplied) |
first_name | PREFERREDNAME | |
last_name | SURNAME | |
See the Linking Providers, Account and Profile Management article for information about how profiles and email addresses are updated.
Example
{
"providerName": "facebook",
"providerDisplayName": "Facebook",
"type": "facebook",
"userPrefix": "FB_",
"params": {
"appId": "000000000000000",
"secret": "abcdef1234567890",
"checkConsentToStoreData": true,
"failIfConsentNotGiven": true
}
}
Setup
You'll need to create a client specific Facebook app that allows access to the "public_profile" and "email" privileges before you'll be able to access Facebook services and query user profile data.
Facebook's documentation for creating an app can be found at https://developers.facebook.com/docs/facebook-login.
In summary you will need to:
- Create a "Basic App"
- Add your site's domain to the basic setting's "App Domain"
- Add a "Website" platform and enter a fully qualified URL to the Authentication worker's re-entry URL as the "Site URL" eg https://mywebsite.com/apiserver/auth/http/reentry
- In the "App Review" section make sure that the "email" and "public_profile" app permissions are approved by default
Once the app is made live, you'll be able to access the "App ID" and "App Secret" needed above.