Gmail and Google Drive

Print Friendly, PDF & Email

Gmail and Google Drive Integration Setup Guide

1. Create a New Project

  1. Sign In to Google Cloud Console
  2. Create a New Project
    • Click the project dropdown menu at the top of the page.
    • Select "New Project".
    • Enter a name for your project in the "Project Name" field.
    • Click "Create" to finalize the creation of the project.

2. Enable APIs

  1. Navigate to API & Services
    • In the left navigation menu, click "API & Services".
  2. Enable Required APIs
    • Click "+ Enable API & Services".
    • Use the search bar to find and enable the following APIs:
      • Gmail API
      • Google Drive API
      • Admin SDK API

3. Create Service Account Credentials

  1. Go to Credentials Tab
    • Under "API & Services," click the "Credentials" tab.
  2. Create Service Account Key
    • Click "Create Credentials" and select "Service Account".
    • Complete the required fields for the service account.
    • Choose "JSON" as the Key type.
    • Click "Continue" to download the JSON key file.

4. Configure Domain-wide Delegation

  1. Access Domain-wide Delegation Settings
    • Navigate to the Google Admin Console.
    • In the left pane, select "Security," then "Access and Data Control," and then "API Controls".
  2. Manage Domain-wide Delegation
    • Under "Domain-wide delegation," click on "Manage Domain Wide Delegation".
    • Click "Add New" to create a new client ID entry.
    • Enter the client ID found in the downloaded JSON file.
  3. Add Scopes
    • Add the following OAuth 2.0 scopes:
      • https://www.googleapis.com/auth/gmail.labels
      • https://www.googleapis.com/auth/gmail.readonly
      • https://mail.google.com/
      • https://www.googleapis.com/auth/admin.directory.user.readonly
      • https://www.googleapis.com/auth/gmail.modify
      • https://www.googleapis.com/auth/drive.readonly
      • https://www.googleapis.com/auth/drive.file
      • https://www.googleapis.com/auth/drive

This guide provides the essential steps for setting up Google Drive and Gmail integration by creating and configuring a Google Cloud project, enabling necessary APIs, generating service account credentials, and setting up domain-wide delegation with the appropriate OAuth scopes.

Was this page helpful?