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

  1. Log in as an admin.

  2. 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

  1. Log in to a Google account.

  2. Navigate to APIs & Services and click Create Project.

  3. Set the Project name and Location as desired.

  4. Click Create.

  5. With the new project selected, navigate to APIs & Services » OAuth consent
    screen.

  6. Select the "External" User Type and click Create.

  7. Set the App name, User support email, and Developer contact information
    fields as desired (all other fields are optional).

  8. Click Save and Continue

  9. On the Scopes add any desired scopes (none are required).

  10. Click Save and Continue.

  11. On the Test users steps add at least one email address to be used for
    testing the implementation.

  12. Click Save and Continue.

  13. Navigate to APIs & Services » Credentials.

  14. Click Create Credentials » OAuth client ID.

  15. Select "Web application" in the Application type field.

  16. Set the Name field as desired.

  17. In the Authorized redirect URIs section click Add URI.

  18. Paste the URL copied from Step 2 in the URI field.

  19. Click Create.

  20. Copy the new Client Secret (Google will not show it again!) and Client ID
    and save them somewhere safe.

  21. Click OK.

In Drupal

  1. Return to Configuration » User authentication » Google

  2. Enter the Google client ID in the Client ID field.

  3. Enter the Google secret key in the Client secret field.

  4. Click Save configuration.

  5. 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.

Supporting organizations: 

Project information

Releases