Configuring the Google App for Gmail OAuth 2.0
Configuration in the Google Cloud Console
- Navigate to the Google Cloud Platform Console.
- From the projects list, create a new project.
- From the new project, enable the Gmail API.
- Open the navigation menu
. - Select APIs & Services and Enabled APIs & services.
- Click Enable APIs and services.
- Search for "Gmail API," then click Gmail API and Enable.
- Open the navigation menu
- Configure the OAuth Consent Screen
- Open the navigation menu
. - Select APIs & Services and OAuth consent screen.
- Open the navigation menu
- Under App Information, specify App name and User support email. Click Next.
- Under Audience, check External, and click Next.
- Under Contact Information, specify an Email address, and click Next.
- Under Finish, check I Agree to the Google API Services: User Data Policy.
- Click Create.
- Navigate to the Audience tab, and click PUBLISH APP to change the app setting to In production.
- Navigate to the Clients tab.
- Click Create client and select Web application for Application type.
- Name: Specify a name for the client.
- Authorized JavaScript origins: Specify the origin of Import Agent web service. To find the JavaScript origin in the Import Agent:
- Open the Import Agent Profile Manager.
- Navigate to the Profile menu.
- Open the Options dialog box, and select the Email Server tab.
- Select Gmail OAuth 2.0 as the Authentication type, and refer to the JavaScript origin section.
- Click Create.
- After creating the credential, copy and save the following values:
- Client ID will be used as the Application (client) ID in Import Agent.
- Client secret will be used as the Client secret in Import Agent.
Troubleshooting
The message "Google hasn’t verified this app" occurs during authorization.
Solution:
- Click Advanced.
- Click Go to <app name> consent screen (unsafe).
Note: This warning appears because the Google app is not verified. Verification is not required if only system administrators configure the email settings.
Error 400: redirect_uri_mismatch
Cause: The authorized JavaScript origin configured in Google Cloud Console does not match the JavaScript origin configured in Import Agent.
Solution: Verify that the Authorized JavaScript origins in Google Cloud Console exactly match the JavaScript origin shown in the Import Agent Profile Manager. (See step 6a above to locate the JavaScxript origin.)
Error: "HttpStatusCode is Forbidden. Delegation denied for xxx@gmail.com" occurs when testing.
Cause: The Sender address does not match the email account used during authorization.
Solution: Ensure that the Sender address in Import Agent matches the email address used to authorize the Google app. To check the Sender address:
- Open the Import Agent Profile Manager.
- From the Profile menu, select Options.
- On the Email Server tab , select Gmail OAuth 2.0 for the Authentication type.
- Locate the Sender address section.