Create OAuth2 Credentials

  1. Create a Project in Google Cloud Console:
    • Go to the Google Cloud Console

    • Create a new project or select an existing project

    • Navigate to the APIs & Services > Library in the Google Cloud Console.

    • Search for Gmail API and click on it. Next click the Enable button to enable the Google Drive Activity API for your project.

    • In the Google Cloud Console, navigate to the APIs & Services > Credentials tab.
    • Click Service account.

    • Under Grant this service account access to the project, select role as Owner and click DONE.

    • Select the newly created service account and click Keys > Add Key > Create new key.

    • Make sure the key type is set to json and click Create.

The new private key pair is generated and downloaded to the machine. Note the values of: private_key, client_email, and client_id.