OAuth Troubleshooting¶
Common issues when setting up OAuth sources (Google Sheets, Google Analytics, Google Ads, Facebook Ads) and how to fix them.
Consent Screen Setup¶
Before creating OAuth credentials, you must configure the OAuth consent screen in Google Cloud Console. This is the screen users see when authorizing your app.
Testing vs Production Mode¶
| Testing Mode | Production Mode | |
|---|---|---|
| Who can authorize | Only emails you add as test users | Anyone with a Google account |
| Token expiry | 7 days — tokens expire and must be re-authorized | No expiry (until revoked) |
| Verification | Not required | Requires Google review |
| Best for | Personal projects, small teams | Apps serving external users |
Testing mode tokens expire after 7 days
If your tokens stop working after a week, this is why. Either re-authorize (dango oauth refresh <oauth_name>) or switch to production mode.
Setting Up the Consent Screen¶
- Go to Google Cloud Console → APIs & Services → OAuth consent screen
- Select External (Internal requires Google Workspace)
- Fill in:
- App name: anything (e.g., "My Analytics")
- User support email: your email
- Developer contact: your email
-
Scopes: click Add or Remove Scopes and add the scopes for your source:
Source Required Scope Google Sheets https://www.googleapis.com/auth/spreadsheets.readonlyGoogle Analytics (GA4) https://www.googleapis.com/auth/analytics.readonlyGoogle Ads https://www.googleapis.com/auth/adwords -
Test users: add the Google account email you'll authorize with
- Click Save
Switching to Production Mode¶
To avoid 7-day token expiry:
- Go to OAuth consent screen → click Publish App
- Google may require a verification review — for apps that only access your own data (limited users, no sensitive scopes), this is usually a quick self-attestation
- After publishing, existing tokens continue working and new tokens don't expire
Common Errors¶
"App not verified" Warning¶
What you see: Google shows "This app isn't verified" with a warning screen.
Why: Your OAuth app is in testing mode (or production mode pending verification).
Fix: This is expected and safe for your own data.
- Click Advanced (small text at bottom left)
- Click Go to [your app name] (unsafe)
- Grant the requested permissions
This is a one-time step per authorization.
"Access blocked: This app's request is invalid"¶
Cause: OAuth redirect URI mismatch.
Fix: In Google Cloud Console → Credentials → your OAuth client → Authorized redirect URIs, add:
If using the Web UI OAuth flow instead of the CLI, add this URI instead:
"Port 8080 already in use"¶
Cause: A previous OAuth attempt didn't release the callback port.
Fix:
# Find and kill the process using port 8080
lsof -ti:8080 | xargs kill -9
# Then retry
dango source add
Token Expired (7-day Testing Mode)¶
Symptoms: Syncs fail with authentication errors after working for a week.
Fix: Re-authorize the source:
# Option A: Refresh the existing token (simplest)
dango oauth refresh <oauth_name> # name from `dango oauth list`
# Option B: Remove and re-add (if refresh fails)
dango oauth remove <source_type> # e.g., google_sheets, google_ads
dango source add
# Select the same source type, same configuration
"Request had insufficient authentication scopes"¶
Cause: The OAuth token was granted with fewer scopes than needed (e.g., you authorized Sheets but now want Analytics).
Fix: Remove the credential and re-authorize with the correct scopes:
Facebook "App Not Reviewed"¶
Cause: Facebook requires app review for certain permissions.
Note: Facebook tokens have a fixed 60-day expiry regardless of app review status. Set a reminder to re-authorize before tokens expire:
Re-Authorization Flow¶
When tokens expire or you need to change scopes:
Local¶
# 1. Try refreshing the token first
dango oauth refresh <oauth_name> # name from `dango oauth list`
# 2. If refresh fails, remove and re-add
dango oauth remove <source_type> # e.g., google_sheets
dango source add
# Select the source type and follow the OAuth prompts
# 3. Verify the new token works
dango sync <source_name>
Cloud¶
After re-authorizing locally, push the updated credentials to your server:
# 1. Re-authorize locally (steps above)
# 2. Push updated credentials to cloud
dango remote push
# 3. Verify on server
dango remote logs --tail 20
Enabling APIs¶
Each Google source requires its specific API enabled in Google Cloud Console:
| Source | API to Enable | Console Name |
|---|---|---|
| Google Sheets | Google Sheets API | Google Sheets API (not "Sheet" — note the plural) |
| Google Analytics (GA4) | Google Analytics Data API | Google Analytics Data API (not Admin API) |
| Google Ads | Google Ads API | Google Ads API |
To enable:
- Go to Google Cloud Console → APIs & Services → Library
- Search for the exact API name
- Click Enable
Google Ads also needs a Developer Token
Google Ads requires a Developer Token from your Google Ads account (not Google Cloud Console). Find it in Google Ads → Tools & Settings → API Center. A test account token works for development.
Checking Token Status¶
This shows credentials that are expired or expiring soon, and prompts you to re-authenticate.
For a full diagnostic (client credentials, saved tokens, live validation):
Quick Reference¶
| Problem | Solution |
|---|---|
| "App not verified" warning | Click Advanced → Go to app (expected) |
| Token expired after 7 days | Switch consent screen to production mode, or re-authorize |
| Port 8080 in use | lsof -ti:8080 \| xargs kill -9 |
| Wrong scopes | dango oauth remove <source_type> then re-add |
| Facebook 60-day expiry | Re-authorize before expiry, push to cloud |
| API not enabled | Enable exact API name in Google Cloud Console |
| Cloud tokens expired | Re-authorize locally, then dango remote push |