Click here to see other types of OAuth2 configurations or follow this tutorial for a detailed step-by-step guide.
Setting up Gmail IMAP integration with EmailEngine
Follow these steps to configure Gmail IMAP with EmailEngine using OAuth2 authentication:
Open the Google Cloud Console
Go to the Google Cloud Console. This is where you manage your Google APIs and services, necessary for enabling OAuth2 authentication for Gmail IMAP access.Create a new project
Click "Create Project" to set up a new Google Cloud project. Each project serves as a container for managing settings like OAuth credentials and API access.Select the created project
Once your project is created, select it to ensure that the configurations and changes you make apply to this project.Enable Gmail API
Navigate to APIs & Services → Enabled APIs and services. Search for "Gmail API" and enable it. Even though we are configuring IMAP, the Gmail API must be enabled to manage OAuth2 access.Set up OAuth consent screen
Navigate to APIs & Services → OAuth consent screen. Google requires a consent screen to notify users of the data your app will access. Choose whether the app will be Internal (for users in the same Google Workspace) or External (for any Gmail user). In this tutorial, we use "Internal."Fill in the OAuth consent form
Fill in the necessary details about your app on the consent form. For example, use the URL of your EmailEngine instance as the "Application home page." This allows Google to recognize your app and provides users with transparency on the data it will access.Configure OAuth scopes
Once the consent form is filled out, click Save and continue to get to the scope configuration screen. Click Add or remove scopes and add the following scope:https://mail.google.com
This scope allows your app to access Gmail through IMAP and SMTP. Click Save and continue.
Create OAuth credentials
Navigate to APIs & Services → Credentials, then click Create Credentials → OAuth client ID. These credentials allow your app to authenticate users and access Gmail IMAP and SMTP services.Set up OAuth client ID
Select Web application as the application type. Under "Authorized JavaScript origins", add your EmailEngine URL. Under "Authorized redirect URIs", add your EmailEngine URL with the/oauth
path (e.g.,https://your-emailengine-url.com/oauth
). This enables the redirect after users authenticate.Download the credentials
After the client ID is created, download the OAuth credentials as a JSON file. This file contains the necessary authentication data for integrating with Gmail IMAP.Create a new Gmail OAuth2 app in EmailEngine
Open EmailEngine and create a new Gmail OAuth2 application. This will set up the integration between EmailEngine and Gmail over IMAP.Upload the JSON credentials
In EmailEngine, select the downloaded JSON file to autofill configuration details such as client ID and secret. This links EmailEngine with Google’s OAuth system.Choose IMAP and SMTP as the base scope
When setting up the OAuth2 app in EmailEngine, choose IMAP and SMTP as the base scope. This ensures that EmailEngine will authenticate and work over IMAP for email retrieval and SMTP for sending.Complete the registration
Click Register app in EmailEngine to complete the integration process. Your app is now ready to use Gmail IMAP through OAuth2 for secure email management.