-
Notifications
You must be signed in to change notification settings - Fork 0
Google Workspace Setup
This guide walks you through setting up Google Workspace or Gmail email integration for FluxDesk. You'll need access to the Google Cloud Console to create OAuth credentials.
- A Google account (Gmail or Google Workspace)
- Access to the Google Cloud Console (https://console.cloud.google.com)
- For Google Workspace: Admin access may be required depending on your organization's policies
- Go to https://console.cloud.google.com
- Sign in with your Google account
- If you don't have a project yet, you'll be prompted to create one
- Click the project dropdown at the top of the page
- Click "New Project"
- Fill in the details:
| Field | Value |
|---|---|
| Project name |
FluxDesk (or your preferred name) |
| Organization | Select your organization (if applicable) |
| Location | Select a folder (if applicable) |
- Click "Create"
- Wait for the project to be created, then select it
- In the left sidebar, navigate to "APIs & Services" → "Library"
- Search for and enable the following APIs:
| API | Purpose |
|---|---|
| Gmail API | Read and send emails |
| Google People API | Get user profile information |
- Search for the API name
- Click on the API card
- Click "Enable"
- Repeat for each required API
- In the left sidebar, go to "APIs & Services" → "OAuth consent screen"
- Select the user type:
| Type | Description |
|---|---|
| Internal | Only users in your Google Workspace organization (no verification needed) |
| External | Any Google account (requires verification for production) |
- Click "Create"
| Field | Value |
|---|---|
| App name | FluxDesk |
| User support email | Your email address |
| App logo | (Optional) Upload your logo |
| App domain | Your application domain |
| Developer contact email | Your email address |
- Click "Save and Continue"
- Click "Add or Remove Scopes"
- Add the following scopes:
| Scope | Description |
|---|---|
openid |
OpenID Connect |
profile |
User profile information |
email |
User email address |
https://www.googleapis.com/auth/gmail.readonly |
Read emails |
https://www.googleapis.com/auth/gmail.send |
Send emails |
https://www.googleapis.com/auth/gmail.modify |
Modify emails (archive, move) |
https://www.googleapis.com/auth/gmail.labels |
Manage labels |
- Click "Update"
- Click "Save and Continue"
- Click "Add Users"
- Enter the email addresses of users who will test the integration
- Click "Save and Continue"
- In the left sidebar, go to "APIs & Services" → "Credentials"
- Click "+ Create Credentials" → "OAuth client ID"
- Select "Web application" as the application type
| Field | Value |
|---|---|
| Name | FluxDesk Web Client |
| Authorized JavaScript origins | https://your-domain.com |
| Authorized redirect URIs | https://your-domain.com/organization/email-channels/oauth/callback/google |
http://localhost:8000
http://localhost:8000/organization/email-channels/oauth/callback/google
- Click "Create"
A dialog will appear with your credentials:
| Value | Description | .env Variable |
|---|---|---|
| Client ID | Ends with .apps.googleusercontent.com
|
GOOGLE_CLIENT_ID |
| Client Secret | A string like GOCSPX-xxxxx
|
GOOGLE_CLIENT_SECRET |
Important: Copy both values now! You can view the Client ID later, but the Client Secret can only be viewed once (though you can create a new one).
Add the following to your .env file:
# Google Workspace / Gmail OAuth Configuration
GOOGLE_CLIENT_ID=your-client-id.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REDIRECT_URI=/organization/email-channels/oauth/callback/googleYour final configuration should look like this:
GOOGLE_CLIENT_ID=123456789012-abcdefghijklmnopqrstuvwxyz123456.apps.googleusercontent.com
GOOGLE_CLIENT_SECRET=GOCSPX-xxxxxxxxxxxxxxxxxxxxxxxxxxxx
GOOGLE_REDIRECT_URI=/organization/email-channels/oauth/callback/google- Go to your FluxDesk application
- Navigate to Organization Settings → E-mailaccounts
- Click "Account toevoegen" (Add Account)
- Enter a name for the email channel
- Select Google Workspace as the provider
- Click "Account toevoegen"
- You'll be redirected to Google's login page
- Sign in with your Google account
- Review and accept the permissions
- You'll be redirected back to FluxDesk
- Configure the email channel settings (folder, sync interval, etc.)
If successful, the email channel will show as "Actief" (Active) with your email address.
No additional steps needed. Your app is immediately available to users in your organization.
External apps start in "Testing" mode with limitations:
- Maximum 100 test users
- Refresh tokens expire after 7 days
- Users see a warning screen during OAuth
To publish for production:
- Go to "OAuth consent screen"
- Click "Publish App"
- Submit for verification
Verification Requirements:
- Privacy policy URL
- Terms of service URL (optional but recommended)
- Justification for each sensitive scope
- Domain verification
Verification can take several weeks. See Google's verification documentation for details.
The redirect URI doesn't match exactly. Check:
- Protocol (http vs https)
- Domain name (no trailing slash)
- Path must be exactly
/organization/email-channels/oauth/callback/google - The redirect URI is added to both "Authorized redirect URIs" in the credential settings
For External apps in testing mode:
- Go to OAuth consent screen → Test users
- Add the email address trying to authenticate
- Click "Save"
This warning appears for External apps that haven't completed Google's verification process. Users can click "Advanced" → "Go to FluxDesk (unsafe)" to proceed during testing.
The refresh token has expired. This can happen because:
- External app in testing mode (tokens expire after 7 days)
- User revoked access in their Google account settings
- The OAuth credentials were regenerated
Solution: Users need to reconnect:
- Go to E-mailaccounts
- Click the menu (⋮) → "Opnieuw verbinden" (Reconnect)
- Re-authenticate with Google
- Check if the channel shows any error in "last_sync_error"
- Verify the Gmail account has emails in the selected label
- Check Laravel logs:
storage/logs/laravel.log - Manually trigger sync:
php artisan email:sync --channel=1 --force - Ensure the Gmail API is enabled in Google Cloud Console
The OAuth token doesn't have all required permissions. Users need to:
- Disconnect the email channel
- Delete and recreate the channel
- Re-authenticate to grant all scopes
| Feature | Gmail (Personal) | Google Workspace |
|---|---|---|
| OAuth consent screen | External | Internal or External |
| Verification required | Yes (for production) | No (for Internal) |
| User limit in testing | 100 users | Unlimited (Internal) |
| Token expiration | 7 days (testing) | No expiration |
| Admin consent | N/A | May be required |
Recommendation: If you're deploying for a single organization, use Google Workspace with an Internal app for the simplest setup.
-
Keep credentials secure - Never commit
.envfiles to version control - Use HTTPS - Always use HTTPS in production for redirect URIs
- Limit test users - Only add necessary users during testing phase
- Complete verification - For External apps, complete Google's verification process
- Monitor usage - Check the Google Cloud Console for API usage and errors
- Rotate credentials - Periodically create new client secrets
| Endpoint | Purpose |
|---|---|
https://accounts.google.com/o/oauth2/v2/auth |
OAuth authorization |
https://oauth2.googleapis.com/token |
Token exchange/refresh |
https://www.googleapis.com/oauth2/v2/userinfo |
Get user profile |
https://gmail.googleapis.com/gmail/v1/users/me/messages |
List/read emails |
https://gmail.googleapis.com/gmail/v1/users/me/messages/send |
Send emails |
https://gmail.googleapis.com/gmail/v1/users/me/labels |
List labels |
// config/services.php
'scopes' => [
'openid',
'profile',
'email',
'https://www.googleapis.com/auth/gmail.readonly',
'https://www.googleapis.com/auth/gmail.send',
'https://www.googleapis.com/auth/gmail.modify',
'https://www.googleapis.com/auth/gmail.labels',
],| Feature | Microsoft 365 | |
|---|---|---|
| Folders | Labels (can apply multiple) | Folders (exclusive) |
| Thread ID | threadId |
conversationId |
| Archive | Remove INBOX label | Move to Archive folder |
| Message format | Base64URL RFC 2822 | Structured JSON |
| Move behavior | Message ID unchanged | Message ID changes |
| Admin portal | Google Cloud Console | Azure Portal |
- Gmail API Documentation
- Google OAuth 2.0 Guide
- Google Cloud Console
- OAuth Consent Screen Configuration
- App Verification Requirements
If you encounter issues not covered in this guide:
- Check the Laravel logs at
storage/logs/laravel.log - Review API usage in the Google Cloud Console
- Test the connection using the "Test verbinding" button in the UI
- Check the Gmail API dashboard for errors
Getting Started
Email Integration
Configuration