Google OAuth Setup
1. Create a Google Cloud Project
- Go to Google Cloud Console
- Click “Create Project” or select an existing project
- Enter a project name and click “Create”
2. Enable Gmail API
- Navigate to APIs & Services > Library
- Search for “Gmail API”
- Click on “Gmail API” and click Enable
3. Configure OAuth Consent Screen
- Navigate to APIs & Services > OAuth consent screen
- Choose External (or Internal if using Google Workspace)
- Fill in required fields:
- App name
- User support email
- Developer contact information
- Click Save and Continue
- On the Scopes page, click Add or Remove Scopes
- Add these scopes:
https://www.googleapis.com/auth/gmail.sendhttps://www.googleapis.com/auth/gmail.readonly
- Click Update then Save and Continue
- Add test users if needed, then Save and Continue
4. Create OAuth Credentials
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth client ID
- Choose Web application
- Enter an application name
- Add Authorized redirect URIs:
http://localhost:3000/oauth/callback(for local development)- Add your production URL if applicable
- Click Create
- Copy your Client ID and Client Secret
5. Configure Environment Variables
Add the following to your .env file:
GOOGLE_CLIENT_ID=your-client-id-here
GOOGLE_CLIENT_SECRET=your-client-secret-hereYour Client ID will look like:
536726988839-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.apps.googleusercontent.com6. Connect Your Email Account
Once configured, you can connect your email account from the Email Accounts dashboard.
Last updated on