Skip to main content
Login with facebook

A login with facebook, google or twitter (or any of the many social media out there) button is essential now because people are lazy. They don't want to fill up forms to sign up to a web service. One click login/sign up is the perfect solution.

Login with facebook is quite simple. All you have to do is install the module and create a facebook app. The social_apisocial_auth module should be installed along with social_auth_facebook. The best way to install and manage drupal modules is composer. 

Install composer like this as described here :

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer

Then go to your Drupal site root or wherever your composer.json for the website is and run the following commands :

composer require drupal/social_api
composer require drupal/social_auth
composer require drupal/social_auth_facebook

Enable both the modules and go to the social_auth config (admin/config/social-api/social-auth) and click on the

 Facebook tab. This is what it would look like :

Login with facebook config

Substitute the values with the values from your facebook app. If you don't have an app, create one at this link https://developers.facebook.com/apps

After you create an app, you should get your app id and app secret by clicking on settings > basic. 

Facebook for developers configs

This is how settings will look: 

Facebook for developers settings

You should not only have an app, you should also add a product. In this case 'Facebook Login' is the product. This is how the product settings look like :

Facebook for developers login product settings

Now you should be able to login with Facebook with the URL 'http://yoursite.com/user/login/facebook'. To test on a local machine, add your local URL as well to the OAuth redirect URLs. 

Enjoy signing in with Facebook. Read the Facebook for developers blog for more info. Or log in and comment here.

x

Work

Therefore logo
80 Atlantic Ave, Toronto, ON Canada
Email: hello@therefore.ca
Call us: +1 4166405376
Linkedin

Let us know how we can help!