- From Setup, enter Auth in the Quick Find box, then select Auth. Providers.
- Click New, then select Facebook for the provider type.
- Name the auth provider Facebook.
- For Registration Handler, click Automatically create a registration handler template.
- For Execute Registration As, choose yourself. Heads up: This step is essential and often gets overlooked.
In production, you don’t choose yourself. You create a service account instead to avoid problems in the future. If you use yourself and leave the company, the process starts to fail when your Salesforce account is disabled.
- For Icon URL, click Choose one of our sample icons, select an icon, copy the URL, and paste it in Icon URL.
- Leave the other fields empty. Salesforce supplies the values, including the consumer key and consumer secret, when you use the Salesforce out-of-the-box providers (Facebook, Google, and so on).
- Click Save.
After defining the auth provider, Salesforce generates several URLs. Use the Test-Only Initialization URL to test your connection with the social network.
- From the auth provider detail page, under Salesforce Configuration, copy the URL displayed in Test-Only Initialization URL.
- Paste the URL into a browser.
If it works, you get the Facebook login page.
-
Log in to the Facebook page.
-
When prompted, authorize your app.
You’re redirected to Salesforce, where you see the XML information that Facebook sent us.
This XML information is useful for debugging and adding more functionality to your auth provider. Here we see that the Facebook user name, his org ID, link to his Facebook account, and email address.
Log In with Facebook
- From Setup, enter All Communities in the Quick Find box, select All Communities, then click Workspaces next to customers.
- Select Administration, then Login & Registration and you see that Facebook is now an option.
To confirm your change, return to your private (incognito) browser and reload the login (customers Communities URL)page. Check that the Facebook icon appears on the login page.
This blog is very useful to learn about the Authentication Provider Setup.