IMAP - Gmail - Setup Account

Zuar Runner uses OAuth 2.0 to gain access to the contents of your Gmail account. This requires the creation of an “app” that will act on your behalf in the Google Cloud Console. Once the app has been created, the credentials associated with the app are used to authenticate Zuar Runner to Gmail when your IMAP job(s) run.

This page will walk you through the steps necessary to create your app within GCP. At a high level, those steps are:

  1. Create a project

  2. Enable the Gmail API

  3. Configure a OAuth consent

  4. Create credentials for the app

Note

You only need to create one “app” within Google Cloud, regardless of the number of IMAP jobs you wish to create. In general, you’ll need one app per Gmail address that you wish to work with.

Create a GCP Project

  1. Login to Google Cloud Console using the Gmail ID you wish to use with your IMAP by navigating to this link:

    https://console.cloud.google.com/

    ../../_images/gmail-setup-account__login1.png
  2. After login, the main GCP dashboard will appear. Your contents will differ from those shown below.

    ../../_images/gmail-setup-account__gcp.png
  3. Start creating a project.

    1. Click the pulldown at the top left of the page.

    2. A “Select a project” popup will appear

    3. Click “NEW PROJECT” in the top right of the popup

    ../../_images/gmail-setup-account__project1.png
  4. Finish creating your project.

    1. In the “New Project” popup that appears

    2. Enter a project name, we’ll use “mitto-imap-example” in this example.

    3. Click “CREATE”

    4. A notification popup will appear stating that the project is being created. It may take a few minutes for the project to be created.

    ../../_images/gmail-setup-account__project2.png
  5. Make the new project active by choosing it from the project pulldown at the top left of the page.

Enable Gmail API

  1. Enable the Gmail API for the project. From the hamburger icon at the top left of the page, follow “API & Services –> Library” to open the Library page.

    ../../_images/gmail-setup-account__api1.png
  2. Find “Gmail” in the list of APIs and click the icon.

    ../../_images/gmail-setup-account__api2.png
  3. On the Gmail API page, click “ENABLE”.

    ../../_images/gmail-setup-account__api3.png

Create Credentials

  1. Select “API & Services –> Credentials” to open the Credentials page.

    ../../_images/gmail-setup-account__creds1.png
  2. An empty Credentials page will be displayed. Click “+CREATE CREDENTIALS –> OAuth client ID”.

    ../../_images/gmail-setup-account__creds2.png
  3. Complete the “Create OAuth client ID” page:

    1. Select “Web application” from the pulldown.

    2. Enter a name for your app.

    3. Under the “Authorized redirect URIs” section of the page, click “+ADD URI” and enter the OAuth redirect for your Zuar Runner instance. This should be the URL of your Zuar Runner instance with /api/oauth_redirect at the end.
      Example: https://your-runner.zuarbase.net/api/oauth_redirect If you have more than one Zuar Runner instance, you can add a URI for each instance.

      Important: your URI must end with /api/oauth_redirect.

    4. Click “CREATE” at the bottom of the page.

      ../../_images/gmail-setup-account__creds2a.png
  4. A “OAuth client created” popup will appear. Click “DOWNLOAD JSON” to download the credentials for this application.

    IMPORTANT: Keep these credentials – you will need them later when using the IMAP wizard to create IMAP jobs.

    ../../_images/gmail-setup-account__creds9.png

Push to Production

The newly-created app will have a “Publishing status” of “Testing”; change it to “Production”.

  1. Click the “PUBLISH APP” button

    ../../_images/gmail-setup-account__publish1.png
  2. A “Push to production?” dialog will appear. Click “CONFIRM”.

    ../../_images/gmail-setup-account__publish2.png

    Note

    The popup will warn that pushing to production will require the app to be verified by Google. These warnings can be safely ignored; it is not necessary to provide the additional information required for app verification.

    Because the app just created is unverified, an “insecure” warning will be displayed when the IMAP wizard authenticates with Gmail. This insecure warning can be ignored.

Success

You have successfully configured an app within GCP that can be used with Zuar Runner’s IMAP job.