Skip to main content
Login with google

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 for 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 google project and enable API and services to get credentials (client secret and id). The social_apisocial_auth module should be installed along with social_auth_google. 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_google

Enable both the modules and go to the social_auth config (admin/config/social-api/social-auth) and click on the Google tab. This is what it would look like :

Login with google config

Substitute the values with the values from your google project that you created in the google cloud platform. If you don't have a project, create one at this link https://console.cloud.google.com

After you create a project, you have to get your Client ID and Client Secret. Go to APIs and Services, and add credentials for OAuth 2.0 : 

Google Oauth 2.0 Client ID and Secret

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

Enjoy signing in with Google. Read the "google for developer's" 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!