Skip to content

Latest commit

 

History

History
52 lines (38 loc) · 2.57 KB

google_cloud_setup.md

File metadata and controls

52 lines (38 loc) · 2.57 KB

Google Cloud Setup for Gmail API

This guide provides a step-by-step walkthrough for configuring your Google Cloud project and obtaining the necessary credentials for the Gmail Polling System.


1. Project Creation and API Activation

To begin, you must create a project in the Google Cloud Console. This project acts as the container for your application's API configuration and billing settings.

  1. Navigate to the Google Cloud Console.
  2. Create a new project (e.g., "Gmail-Polling-Service").
  3. Go to the APIs & Services section from the sidebar.
  4. Click on Enable APIs and Services and search for "Gmail API".
  5. Select it and click Enable. Once enabled, you will see the API status as "Enabled" in the dashboard.

2. OAuth Consent Screen Configuration

Before generating credentials, you must define how the application requests access to user data.

  1. Navigate to APIs & Services > OAuth Consent Screen.
  2. Select User Type (typically "External" for development or testing).
  3. Provide the required branding information (App Name, User Support Email).
  4. In the Scopes (Data Access) section, click Add or Remove Scopes.
  5. Add the following specific permissions required for this system:
    • .../auth/gmail.send: Allows the application to send emails on your behalf.
    • .../auth/gmail.readonly: Allows the application to view email messages and settings.
  6. Ensure your email address is added to the Test Users section to allow access during the development phase.

3. Generating OAuth 2.0 Credentials

Once the consent screen is configured, you need to create the client credentials that your code will use to identify itself.

  1. Navigate to APIs & Services > Credentials.
  2. Click on + Create Credentials at the top of the screen.
  3. Select OAuth Client ID.
  4. Choose Desktop App as the Application Type.
  5. Assign a name to your credential (e.g., "Gmail Polling Client").

4. Downloading the Credentials File

After creating the OAuth Client ID, a dialog will appear with your Client ID and Client Secret.

  1. Crucial Step: Click the Download JSON button.
  2. The downloaded file contains sensitive configuration data.
  3. Rename this file to token.json.
  4. Place the token.json file in the app directory of the project.

Warning

Security Reminder: The token.json file grants access to your Google Cloud Project. Never commit this file to public version control systems (like GitHub). Verify it is listed in your .gitignore.