Please Disable Your Browser Adblock Extension for our site and Refresh This Page!

our ads are user friendly, we do not serve popup ads. We serve responsible ads!

Refresh Page
Skip to main content
On . By CodimTh
Category:

How to login with google in Drupal 8 & 9

 

Login with Google 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. 

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 :

 

How to login with google in Drupal 8 & 9

 

Fill in  this form 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 : 

 

How to login with google in Drupal 8 & 9

 

 

 

Now you should be able to login with google with the URL 'http://yoursite.com/user/login/google'. or if you want to add button login with google, just add "Social Auth Login" Block to a region like this:

 

How to login with google in Drupal 8 & 9

 

Also to test on a local machine, add your local URL as well to the OAuth redirect URLs. 

 

I hope you found this article useful. let me know if you have any questions and I’ll be happy to answer them.

Comments

Add new comment

Restricted HTML

Search

Page Facebook

Become a patron

If you need some help or you search a Drupal freelancer don't hesitate to contact us.

 

Contact Us

All the content is FREE but I still need your help

 

Become a patreon