Gmail OAuth2

⚠️ Advanced setup. For Gmail we recommend the Gmail App Password type, which is much simpler.

Gmail OAuth2 is only advisable if you have an IT technician and a Google Workspace account:

  • On Google Workspace, the application can be internal to your organization and access does not expire.
  • On free Gmail accounts, the application stays in testing and Google cuts off access after 7 days, forcing you to repeat the consent every week. The alternative is to publish the application and submit it for Google’s verification, a long and demanding process designed for software companies.

1. Create the application in Google Cloud

With a Google Workspace administrator account, at console.cloud.google.com:

  1. Create a new project (for example, “GC”).
  2. In Google Auth Platform (OAuth consent screen):
    • Audience: choose Internal.
    • Fill in the application name and contact emails.
    • Under Data access, add the scope https://mail.google.com/.
  3. Under Clients, create an OAuth client ID of type Web application.
    • Under Authorized redirect URIs, paste the Redirect Uri that GC shows on the account (see step 2).
  4. Save the client ID and the client secret.

2. Set up in GC

Go to Administration >> Email >> Sending Accounts, click Add and choose the Gmail OAuth2 type.

  1. Fill in Username (the Google address), E-Mail: From, Name, Client Id and Client Secret, and save.
  2. After saving, GC shows the Redirect Uri: this is the address to register in Google Cloud (step 1.3).
  3. Click Consent, sign in with the Google account and authorize.
  4. Click Test.

❓ If it stops working

  • Free account / application in testing: access expires after 7 days — click Consent again, or switch to Gmail App Password.
  • Client secret deleted or replaced in Google Cloud: update the Client Secret in GC and give Consent again.