Skip to content

Gmail Configuration

Create the Client ID and Client Secret

  1. Navigate to API Credentials Page and sign in with your Google account.

  2. Click on Select a Project and click NEW PROJECT, to create a project. Creating a new Project

  3. Enter GmailConnector as the name of the project and click Create.

  4. Click Configure consent screen in the next screen. Consent Screen

  5. Provide the Application Name as GmailConnector, and provide your email as User support email and email address of Developer contact information in the Consent Screen, then click SAVE AND CONTINUE.. Consent Screen

  6. Add scopes of API, then click SAVE AND CONTINUE. Consent Screen

  7. Click ADD USERS, type the email of the account that you will use for testing, then click SAVE AND CONTINUE. Consent Screen

  8. Click Create credentials and click OAuth client ID. Create Credentials

  9. Enter the following details in the Create OAuth client ID screen and click Create.

Type Name
Application type Web Application
Name GmailConnector
Authorized redirect URIs https://developers.google.com/oauthplayground
  1. A Client ID and a Client Secret are provided. Keep them saved. Credentials

  2. Click Library on the side menu, search for Gmail API and click on it.

  3. Click Enable to enable the Gmail API.

Obtain access token and refresh token

  1. Navigate to OAuth 2.0 Playground and click OAuth 2.0 Configuration button in the Right top corner.

  2. Select Use your own OAuth credentials, and provide the obtained Client ID and Client Secret values as above click on Close. Obtaining Oauth-configuration

  3. Under Step 1, select Gmail API v1 from the list of APIs, select all the scopes expect the gmail.metadata scope scope.

Selecting Scopes

  1. Click on Authorize APIs button and select your Gmail account when you are asked and allow the scopes. Grant Permission

  2. Under Step 2, click Exchange authorization code for tokens to generate an display the Access Token and Refresh Token. Now we are done with configuring the Gmail API. etting Tokens