This project is part of the Drupal Social Initiative and is based on the Social API.
Social Auth Google allows users to register and login to your Drupal site with their Google account. The module allows websites to request any scopes, so any tasks requiring authentication with Google services can be performed. This module is based on Social Auth and Social API projects.
This module adds a path user/login/google
which redirects the user to Google Accounts for authentication.
After Google has returned the user to your site, the module compares the user id or email address provided by Google. If the user has previously registered using Google or your site already has an account with the same email address, the user is logged in. If not, a new user account is created. Also, a Google account can be associated with an authenticated user.
Login process can be initiated from the "Google" button in the Social Auth block. Alternatively, site builders can place (and theme) a link to user/login/google
wherever on the site.
Configuration
In Drupal
-
Log in as an admin.
-
Navigate to Configuration » User authentication » Google and copy
the Authorized redirect URL field value (the URL should end in
/user/login/google/callback
).
In Google Cloud Console
-
Log in to a Google account.
-
Navigate to APIs & Services and click Create Project.
-
Set the Project name and Location as desired.
-
Click Create.
-
With the new project selected, navigate to APIs & Services » OAuth consent
screen. -
Select the "External" User Type and click Create.
-
Set the App name, User support email, and Developer contact information
fields as desired (all other fields are optional). -
Click Save and Continue
-
On the Scopes add any desired scopes (none are required).
-
Click Save and Continue.
-
On the Test users steps add at least one email address to be used for
testing the implementation. -
Click Save and Continue.
-
Navigate to APIs & Services » Credentials.
-
Click Create Credentials » OAuth client ID.
-
Select "Web application" in the Application type field.
-
Set the Name field as desired.
-
In the Authorized redirect URIs section click Add URI.
-
Paste the URL copied from Step 2 in the URI field.
-
Click Create.
-
Copy the new Client Secret (Google will not show it again!) and Client ID
and save them somewhere safe. -
Click OK.
In Drupal
-
Return to Configuration » User authentication » Google
-
Enter the Google client ID in the Client ID field.
-
Enter the Google secret key in the Client secret field.
-
Click Save configuration.
-
Navigate to Structure » Block Layout and place a Social Auth login block
somewhere on the site (if not already placed).
That's it! Log in with one of the test users added during the setup in Google
Cloud.
When ready log in to Google Cloud Console, navigate to APIs & Services » OAuth
consent screen, and click Publish App to enable access for any user with a
Google account.
Project information
- Module categories: Integrations, Access Control
- Ecosystem: Social Auth, Social API
- 3,729 sites report using this module
- Created by gvso on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.