⚠️ 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:
- Create a new project (for example, “GC”).
- 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/.
- 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).
- 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.
- Fill in Username (the Google address), E-Mail: From, Name, Client Id and Client Secret, and save.
- After saving, GC shows the Redirect Uri: this is the address to register in Google Cloud (step 1.3).
- Click Consent, sign in with the Google account and authorize.
- 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.