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 Pi-hole blocking Google domains. Triggers on "access denied", "OAuth not working", "login loop", "CookieMismatch", "can only be used within organization", or "fix Cloudflare Access authentication". Works with Cloudflare Access, Google OAuth, Pi-hole whitelist, and ACCESS_ALLOWED_EMAIL configuration.
What this skill does
# Troubleshoot Cloudflare Access Authentication Skill Systematic diagnosis and resolution of Cloudflare Access authentication issues including Google OAuth errors and access policy problems. ## Quick Start Quick diagnostics for Access issues: ```bash # 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 ``` ## Table of Contents 1. [When to Use This Skill](#1-when-to-use-this-skill) 2. [What This Skill Does](#2-what-this-skill-does) 3. [Instructions](#3-instructions) - 3.1 Verify Google OAuth Configuration - 3.2 Check Allowed Email Configuration - 3.3 Verify Pi-hole Whitelist - 3.4 Test Google OAuth Consent Screen - 3.5 Check Access Policy in Dashboard - 3.6 Verify Redirect URI Configuration - 3.7 Apply Fix 4. [Supporting Files](#4-supporting-files) 5. [Expected Outcomes](#5-expected-outcomes) 6. [Requirements](#6-requirements) 7. [Red Flags to Avoid](#7-red-flags-to-avoid) ## When to Use This Skill **Explicit Triggers:** - "Access denied" - "OAuth not working" - "Login loop" - "CookieMismatch error" - "Can only be used within organization" - "Fix Cloudflare Access" **Implicit Triggers:** - Google login succeeds but then shows "Access Denied" - Redirected back to login after successful Google authentication - Browser stuck in authentication loop - "This app is not verified" but can't proceed **Debugging Triggers:** - "Why am I denied after login?" - "Why is authentication not working?" - "How to fix Google OAuth errors?" ## What This Skill Does 1. **Checks OAuth Config** - Verifies Google OAuth credentials are set 2. **Validates Emails** - Confirms allowed emails are configured 3. **Checks Whitelist** - Verifies Pi-hole not blocking Google domains 4. **Tests Consent** - Validates Google OAuth consent screen configuration 5. **Reviews Policy** - Checks Access policy in Cloudflare dashboard 6. **Verifies Redirect** - Confirms redirect URI matches team name 7. **Provides Fix** - Gives specific commands to resolve the issue ## Instructions ### 3.1 Verify Google OAuth Configuration Check OAuth credentials are set: ```bash # 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:** 1. Go to Google Cloud Console: https://console.cloud.google.com/apis/credentials 2. Create OAuth 2.0 Client ID if needed: - Application type: Web application - Authorized redirect URIs: `https://<TEAM_NAME>.cloudflareaccess.com/cdn-cgi/access/callback` 3. Copy Client ID and Client Secret 4. Add to .env: ```bash GOOGLE_OAUTH_CLIENT_ID="your-client-id.apps.googleusercontent.com" GOOGLE_OAUTH_CLIENT_SECRET="your-client-secret" ``` 5. Re-run Cloudflare Access setup: ```bash /home/dawiddutoit/projects/network/scripts/cf-access-setup.sh setup ``` ### 3.2 Check Allowed Email Configuration Verify emails are configured: ```bash grep ACCESS_ALLOWED_EMAIL /home/dawiddutoit/projects/network/.env ``` Expected: Shows comma-separated list of allowed email addresses **If missing or incorrect:** 1. Edit .env: ```bash nano /home/dawiddutoit/projects/network/.env ``` 2. Add or update: ```bash ACCESS_ALLOWED_EMAIL="[email protected],[email protected]" ``` 3. Update Access policies: ```bash /home/dawiddutoit/projects/network/scripts/update-access-emails.sh ``` **Common mistake:** Email in policy doesn't match Google account used for login. ### 3.3 Verify Pi-hole Whitelist Pi-hole must allow Google domains for OAuth to work: **Check if Google domains are whitelisted:** ```bash # 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): ```bash /home/dawiddutoit/projects/network/scripts/setup-google-whitelist.sh ``` **Whitelisted domains include:** - Authentication: `accounts.google.com`, `login.google.com`, `id.google.com` - Cookie sync: `doubleclick.net`, `google-analytics.com`, `googlesyndication.com` - YouTube: `youtube.com`, `googlevideo.com`, `ytimg.com` - OAuth/API: `googleapis.com`, `gstatic.com`, `googleusercontent.com` **After whitelisting:** 1. Clear browser cache and cookies for Google domains 2. Flush DNS cache on client device 3. Restart browser completely 4. Try authentication again ### 3.4 Test Google OAuth Consent Screen Verify OAuth consent screen configuration: 1. Go to: https://console.cloud.google.com/apis/credentials/consent 2. Check "Publishing status" **Common issue: "Can only be used within its organization"** **Cause:** OAuth consent screen set to "Internal" but using personal Gmail account **Fix:** 1. Click "Edit App" 2. Change "User Type" from "Internal" to "External" 3. Save and continue through wizard 4. Status should show "In production" or "Testing" **If using External + Testing mode:** - Add test users in "Test users" section - Must include all ACCESS_ALLOWED_EMAIL addresses ### 3.5 Check Access Policy in Dashboard Verify policy in Cloudflare Zero Trust: 1. Go to: https://one.dash.cloudflare.com 2. Navigate to: Access → Applications 3. Find your application (e.g., "Pi-hole Access") 4. Click "Edit" → "Policies" **Verify policy settings:** - Action: "Allow" - Include rule: "Emails" with your email addresses - Or: "Emails ending in" with your domain **Common issue:** Email in policy doesn't match exactly **Example:** - Policy has: `[email protected]` - Login uses: `[email protected]` - Result: Access denied (email mismatch) **Fix:** Update policy to use correct email addresses: ```bash /home/dawiddutoit/projects/network/scripts/update-access-emails.sh ``` ### 3.6 Verify Redirect URI Configuration OAuth redirect URI must match Cloudflare team name: **Check team name:** ```bash grep CLOUDFLARE_TEAM_NAME /home/dawiddutoit/projects/network/.env ``` **Verify redirect URI in Google Console:** 1. Go to: https://console.cloud.google.com/apis/credentials 2. Click your OAuth 2.0 Client ID 3. Check "Authorized redirect URIs" **Expected:** ``` https://<TEAM_NAME>.cloudflareaccess.com/cdn-cgi/access/callback ``` **If mismatch:** 1. Update redirect URI in Google Console to match team name 2. Or re-run Access setup to sync: ```bash /home/dawiddutoit/projects/network/scripts/cf-access-setup.sh setup ``` ### 3.7 Apply Fix **Fix A: Access Denied After Login** **Symptoms:** Google login succeeds, then immediately shows "Access Denied" **Causes:** - Email not in ACCESS_ALLOWED_EMAIL - Email in policy doesn't match login email **Fix:** ```bash # 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:** - Browser cookies blocked or cleared - Pi-hole blocking Google domains - Redirect URI mismatch **Fix:** ```bash # 1. Apply Google whitelist /home/dawiddutoit/projects/network
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.