OAuth Management
Google OAuth authentication allows users to access Zuora Workflow Manager using their own Google Account, simplifying credential management and improving security.Overview
OAuth Benefits
| Benefit | Description |
|---|---|
| Security | Passwords managed by Google, not stored locally |
| Convenience | One-click access (Single Sign-On) |
| User management | Automatic account creation on first login |
| Avatar | Automatic avatar from Google Profile |
| Additional security | Email domain verification |
How It Works
OAuthService Role
TheOAuthService centralizes OAuth logic:
OAuth Configuration
Prerequisites
- Google account with Google Cloud Console access
- Access to create OAuth credentials
super_adminrole in Zuora Workflow Manager
Step 1: Create OAuth Credentials on Google
1.1 Access Google Cloud Console
- Go to Google Cloud Console
- Create or select an existing project
1.2 Enable Google+ API
- Navigate to APIs & Services → Library
- Search for “Google+ API” or “People API”
- Click on Enable
1.3 Configure OAuth Consent Screen
- Navigate to APIs & Services → OAuth consent screen
- Select External (for production)
- Fill out:
- App name: Your application name
- User support email: Support email
- Developer contact email: Contact email
- Click on Save and Continue
- Scroll through subsequent sections and click Save and Continue
1.4 Create OAuth Client ID
- Navigate to APIs & Services → Credentials
- Click on Create Credentials → OAuth client ID
- Select Web application
-
Fill out:
- Name: Descriptive name (e.g., “Zuora Workflow Manager”)
- Authorized redirect URIs:
- Development:
https://zuora-workflows.lndo.site/oauth/google/callback - Production:
https://yourdomain.com/oauth/google/callback
- Development:
- Click on Create
1.5 Copy Credentials
After creation, Google will display:- Client ID: Copy and save
- Client Secret: Copy and save
Step 2: Configure OAuth in Settings
2.1 Access Settings
- Login to Zuora Workflow Manager as
super_admin - Navigate to Settings → General Settings
2.2 OAuth Configuration
In the OAuth Configuration section:| Field | Description | Example |
|---|---|---|
| OAuth Enabled | Enable/disable Google login | true / false |
| Allowed Domains | Allowed email domains | example.com,company.org |
| Google Client ID | Client ID from Google Cloud Console | 123456789-abc...apps.googleusercontent.com |
| Google Client Secret | Client Secret from Google Cloud Console | GOCSPX-... |
2.3 Configure Fields
OAuth Enabled:- Toggle to
trueto enable
- Enter allowed email domains
- Separate with commas:
example.com,company.org - Supports wildcard:
*.example.com
Only users with emails in these domains can access via OAuth.
- Paste the Client ID copied from Google Cloud Console
- Ensure you copy it completely
- Paste the Client Secret
- Will be automatically encrypted in the database
- Won’t be displayed in plain text after saving
2.4 Save Settings
Click on Save in the bottom right.Configuring Email Domains
Specific Domains
Allow only specific domains:Wildcard
Use wildcard to allow subdomains:Multiple
Separate domains with commas or new lines:Validation
Domain validation happens viaValidateDomain rule:
Accessing with OAuth
First Login
1. Login Page
On the login page, you’ll see:- Email: Email field for traditional login
- Password: Password field for traditional login
- “Sign in with Google”: OAuth button
2. Click “Sign in with Google”
Click on the Google button. You’ll be redirected to Google.3. Google Authorization
Google will show you:- Application name
- Domains it will have access to (email, profile)
- Authorization request
4. Automatic Account Creation
If the user doesn’t exist:- App retrieves Google profile
- Automatically creates a new User:
- Automatically assigns
workflow_userrole - Logs in
The new user is assigned
workflow_user role by default.5. Login Complete
You’ll be redirected to the dashboard with active session.Subsequent Logins
For subsequent logins, the process is faster:- Click “Sign in with Google”
- If already logged in to Google, automatic authorization
- Immediate redirect to dashboard
Logout
Logout works like traditional logout:- Click on profile avatar in the header
- Click on Logout
- Local session terminated
Logout from Zuora Workflow Manager doesn’t logout from Google. For complete logout, you must also logout from Google.
Managing OAuth Users
Avatar
OAuth users automatically get:- Avatar URL: Profile image from Google
- Saved in the
avatar_urlfield of the User model - Displayed in the admin panel
Assigned Role
The listenerAssignWorkflowRoleOnSocialiteRegistration automatically assigns workflow_user role to new OAuth users:
Modifying OAuth User Role
To modify an OAuth user’s role:- Navigate to Users
- Click on the OAuth user
- Modify the Roles section
- Add or remove roles
- Click on Save
Reset Password
OAuth users don’t have a local password:- They can’t login with email + password
- If you want to enable traditional login too, set a password manually
OAuth Troubleshooting
Error: “Domain not allowed”
Symptom:- The email domain is not in “Allowed Domains”
- OAuth configuration is not saved
- The domain has incorrect syntax
-
Verify Allowed Domains:
- Settings → General Settings → OAuth Configuration
- Check that the domain is present
- Add the domain if missing
-
Verify configuration:
-
Check domain syntax:
- Correct:
example.com - Incorrect:
@example.com,http://example.com
- Correct:
Error: “Invalid OAuth credentials”
Symptom:- Incorrect Client ID or Secret
- OAuth Client not configured correctly on Google
- Redirect URI doesn’t match
-
Verify Client ID and Secret:
- Settings → General Settings → OAuth Configuration
- Copy again from Google Cloud Console
- Ensure no extra spaces
-
Verify Redirect URI:
- Google Cloud Console → Credentials → OAuth Client ID
- Check Authorized redirect URIs
- Must be exactly:
{APP_URL}/oauth/google/callback
-
Test with cURL:
Error: “Access denied”
Symptom:- User clicked “Cancel” on Google
- OAuth consent screen not configured
- Scopes not approved
-
User must accept:
- Click “Sign in with Google” again
- Click “Allow” on the Google screen
-
Verify OAuth consent screen:
- Google Cloud Console → OAuth consent screen
- Ensure it’s configured
- If in “Testing”, add users as test users
Error: “Redirect URI mismatch”
Symptom:- APP_URL in .env doesn’t match Redirect URI
- Different port between .env and Google Cloud Console
-
Verify APP_URL:
-
Verify Redirect URI in Google:
- Must be exactly:
https://zuora-workflows.lndo.site/oauth/google/callback - No trailing slash
- Must be exactly:
-
Update if necessary:
Avatar Not Showing
Symptom: OAuth user doesn’t show avatar Solutions:-
Verify avatar_url:
-
Check listener:
-
Verify configuration:
- The
UpdateUserAvatarOnSocialiteLoginlistener must be registered - Check
app/Listeners/UpdateUserAvatarOnSocialiteLogin.php
- The
User Not Created After OAuth
Symptom: OAuth login appears to work but user not created Diagnosis:-
Verify listener registered:
-
Verify domain validation:
- Is the email domain in Allowed Domains?
- Is the
ValidateDomainrule configured?
-
Check for errors:
Best Practices
Security
1. Limit allowed domains: ✅ Good practices:- Specify specific enterprise domains
- Use wildcard only if necessary
- Remove unused domains
- Leaving Allowed Domains empty (allows all)
- Using generic wildcards (e.g.,
*) - Including public email provider domains (gmail.com, etc.) if not needed
- Assign roles with least privilege possible
workflow_useris a good default for most users- Consider assigning higher roles only after approval
- Check OAuth login logs
- Monitor new user registrations
- Investigate logins from unusual domains
User Experience
1. Clear communication:- Explain to users how OAuth works
- Provide instructions for first login
- Communicate which domains are supported
- Keep traditional login available
- Users without Google Account can still access
- OAuth users can also have a password (for backup)
- Document account recovery process
- Provide contacts for OAuth issues
- Create FAQ for common questions
Configuration
1. Separate environments:- Use separate OAuth credentials for dev/test/prod
- Don’t reuse Client Secrets between environments
- Update Redirect URI for each environment
- Record when OAuth credentials are generated/updated
- Keep track of who has access to credentials
- Rotate credentials regularly (6-12 months)
- Test complete OAuth flow before enabling in production
- Verify all scenarios (first login, subsequent login, errors)
- Test with multiple email domains