Create OAuth2 Credentials
- 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 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 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 .

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