xiaohongshu
xiaohongshu
cloudflare-access-troubleshoot
Diagnoses and fixes Cloudflare Access authentication issues including Google OAuth errors, access denied after login, login loops, CookieMismatch errors, and "can only be used within its organization" errors. Use when authentication fails, access denied after Google login, redirect failures, or P...
Full skill instructions
Systematic diagnosis and resolution of Cloudflare Access authentication issues including Google OAuth errors and access policy problems.
Quick diagnostics for Access issues:
# Check allowed emails configured
grep ACCESS_ALLOWED_EMAIL /home/dawiddutoit/projects/network/.env
# Verify Google OAuth credentials set
grep GOOGLE_OAUTH /home/dawiddutoit/projects/network/.env
# Check if Google domains are whitelisted in Pi-hole
docker exec pihole pihole -q accounts.google.com
docker exec pihole pihole -q login.google.com
# Apply Google whitelist (fixes CookieMismatch)
/home/dawiddutoit/projects/network/scripts/setup-google-whitelist.sh
Explicit Triggers:
Implicit Triggers:
Debugging Triggers:
Check OAuth credentials are set:
# Check OAuth Client ID
grep GOOGLE_OAUTH_CLIENT_ID /home/dawiddutoit/projects/network/.env
# Check OAuth Client Secret
grep GOOGLE_OAUTH_CLIENT_SECRET /home/dawiddutoit/projects/network/.env
Expected: Both should show values (not empty)
If missing:
https://<TEAM_NAME>.cloudflareaccess.com/cdn-cgi/access/callbackGOOGLE_OAUTH_CLIENT_ID="your-client-id.apps.googleusercontent.com"
GOOGLE_OAUTH_CLIENT_SECRET="your-client-secret"
/home/dawiddutoit/projects/network/scripts/cf-access-setup.sh setup
Verify emails are configured:
grep ACCESS_ALLOWED_EMAIL /home/dawiddutoit/projects/network/.env
Expected: Shows comma-separated list of allowed email addresses
If missing or incorrect:
nano /home/dawiddutoit/projects/network/.env
ACCESS_ALLOWED_EMAIL="[email protected],[email protected]"
/home/dawiddutoit/projects/network/scripts/update-access-emails.sh
Common mistake: Email in policy doesn't match Google account used for login.
Pi-hole must allow Google domains for OAuth to work:
Check if Google domains are whitelisted:
# Check essential auth domains
docker exec pihole pihole -q accounts.google.com
docker exec pihole pihole -q login.google.com
docker exec pihole pihole -q id.google.com
docker exec pihole pihole -q doubleclick.net
Expected: Each shows "Exact whitelist match"
If blocked or not whitelisted:
Apply Google/YouTube whitelist (automatic via docker-compose.yml pihole-init service):
/home/dawiddutoit/projects/network/scripts/setup-google-whitelist.sh
Whitelisted domains include:
accounts.google.com, login.google.com, id.google.comdoubleclick.net, google-analytics.com, googlesyndication.comyoutube.com, googlevideo.com, ytimg.comgoogleapis.com, gstatic.com, googleusercontent.comAfter whitelisting:
Verify OAuth consent screen configuration:
Common issue: "Can only be used within its organization"
Cause: OAuth consent screen set to "Internal" but using personal Gmail account
Fix:
If using External + Testing mode:
Verify policy in Cloudflare Zero Trust:
Verify policy settings:
Common issue: Email in policy doesn't match exactly
Example:
[email protected][email protected]Fix: Update policy to use correct email addresses:
/home/dawiddutoit/projects/network/scripts/update-access-emails.sh
OAuth redirect URI must match Cloudflare team name:
Check team name:
grep CLOUDFLARE_TEAM_NAME /home/dawiddutoit/projects/network/.env
Verify redirect URI in Google Console:
Expected:
https://<TEAM_NAME>.cloudflareaccess.com/cdn-cgi/access/callback
If mismatch:
/home/dawiddutoit/projects/network/scripts/cf-access-setup.sh setup
Fix A: Access Denied After Login
Symptoms: Google login succeeds, then immediately shows "Access Denied"
Causes:
Fix:
# 1. Verify email configuration
grep ACCESS_ALLOWED_EMAIL /home/dawiddutoit/projects/network/.env
# 2. Update if needed
nano /home/dawiddutoit/projects/network/.env
# Add: ACCESS_ALLOWED_EMAIL="[email protected]"
# 3. Update Access policies
/home/dawiddutoit/projects/network/scripts/update-access-emails.sh
# 4. Clear browser cookies
# Browser → Settings → Privacy → Clear browsing data → Cookies (*.cloudflareaccess.com)
# 5. Try again in incognito window
Fix B: Login Loop
Symptoms: Redirected back to login after successful authentication
Causes:
Fix:
# 1. Apply Google whitelist
/home/dawiddutoit/projects/network/scripts/setup-google-whitelist.sh
# 2. Clear all browser data
# Clear cache, cookies, and site data completely
# 3. Flush DNS cache
sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder # macOS
sudo systemd-resolve --flush-caches # Linux
# 4. Restart browser completely
# 5. Try incognito window
Fix C: CookieMismatch Error
Symptoms: Error message about cookie mismatch during OAuth
Cause: Pi-hole blocking Google cookie sync domains
Fix:
# Apply Google whitelist
/home/dawiddutoit/projects/network/scripts/setup-google-whitelist.sh
# Verify domains whitelisted
docker exec pihole pihole -q doubleclick.net
docker exec pihole pihole -q google-analytics.com
# Clear browser cookies
# Browser → Settings → Clear browsing data
# Try again
Fix D: "Can only be used within its organization"
Symptoms: Error message when trying to authenticate
Cause: OAuth consent screen set to "Internal" with personal Gmail
Fix:
Fix E: OAuth Redirect Failure
Symptoms: Redirect fails or goes to wrong URL
Cause: Redirect URI doesn't match team name
Fix:
# 1. Get team name
grep CLOUDFLARE_TEAM_NAME /home/dawiddutoit/projects/network/.env
# 2. Update redirect URI in Google Console
# Go to: https://console.cloud.google.com/apis/credentials
# Update to: https://<TEAM_NAME>.cloudflareaccess.com/cdn-cgi/access/callback
# 3. Or re-run setup to sync
/home/dawiddutoit/projects/network/scripts/cf-access-setup.sh setup
| File | Purpose |
|---|---|
references/reference.md | Google OAuth setup details, Access policy configuration |
examples/examples.md | Example configurations, common error scenarios |
Success:
Partial Success:
Failure Indicators:
*@yourdomain.com*.cloudflareaccess.com domain when troubleshootingxiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience