Gmail and Google Drive Integration Setup Guide
1. Create a New Project
- Sign In to Google Cloud Console
- Go to Google Cloud Console.
- Sign in with your Google account.
- 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
- Navigate to API & Services
- In the left navigation menu, click "API & Services".
- 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
- Go to Credentials Tab
- Under "API & Services," click the "Credentials" tab.
- 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
- 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".
- 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.
- 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
- Add the following OAuth 2.0 scopes:
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.