I'm a big fan of single-sign on (SSO) systems. Keeping one account secure and up-to-date is much easier than dealing with hundreds of logins and passwords for hundreds of sites. Fortunately, many of our clients agree with that and introduce single-sign on mechanisms on their sites and apps.
The most popular choice for SSO nowadays is to use Facebook as identity provider. Fortunately, Facebook authentication is quite well supported by Drupal.
There are many ways to integrate Drupal with Facebook authentication. We usually use oAuth protocol and OAuthConnector module. Below you can find a list of steps that will guide you through configuration of this module. Note that this is not a complete, step-by-step tutorial on integrating Drupal with Facebook. If you need more detailed guidance or help, contact us to get our (really affordable :)) consulting services.
- First, you must install and enable OAuthConnector with all requirements.
- On /admin/structure/oauthconnector page, add Facebook using "add provider from preset" option
- Set OAuth Consumer Key and OAuth Consumer Secret based on data read from Facebook website (see below)
After saving above configuration, you will see a link to connect with Facebook in "Connect URL" column of /admin/structure/oauthconnector page; use this link to create your own "connect with Facebook" button. If you get an error like:
SSL certificate problem: unable to get local issuer certificate
you need to define SSL root certificate for CURL - open php.ini. Find option:
where <path-to-cacert.pem> means path to file with certificates, which can be downloaded from http://curl.haxx.se/ca/cacert.pem (note: if you don't trust the linked file - and you definitely should not trust it, especially for production use - generate your own, based on information available on the Web). After making this change, restart Apache.
To configure Facebook, you must:
- Create a new app at https://developers.facebook.com/apps
- Edit created app, find App ID and App Secret and use them as OAuth Consumer Key and OAuth Consumer Secret in Drupal provider configuration
- Add your domain to App Domains option
- Add URL to your site (like http://www.mysite.com/) to Website with Facebook Login (note: URL to your site must be a subdomain of one of App Domains).
After saving your changes and waiting a few minutes, you will be able to log in to your Drupal site with Facebook account. Use the URL which can be found in /admin/structure/oauthconnector . You can also enable and use "connector" block, which is available in admin/structure/block .