dawiddutoit/custom-claude/cloudflare-service-token-setup
Claude Code and agent skill by dawiddutoit/custom-claude
- community
Checking that the SKILL.md file is still in the repository.
Creates and manages Cloudflare Access service tokens for automated infrastructure verification and non-human access. Use when setting up automation, verification scripts, monitoring systems, or need to test services without Google OAuth. Triggers on "create service token", "setup automation access", "verify without OAuth", "automated monitoring", or "service token for testing". Works with Cloudflare Access Service Auth, .env credential storage, and cf-service-token.sh script for testing and management.
Install
npx vskill@latest install dawiddutoit/custom-claude/cloudflare-service-token-setupSKILL.md
Service Token Setup Skill
Complete workflow for creating and managing Cloudflare Access service tokens for automated infrastructure verification and non-human access.
Quick Start
Quick service token setup:
Table of Contents
- 3.1 Understanding Service Tokens vs OAuth
- 3.2 Create Service Token via Dashboard
- 3.3 Add Credentials to .env
- 3.4 Test Service Token Access
- 3.5 Use Helper Script for Verification
- 3.6 Revoke or Rotate Service Token
- 3.7 Monitor Service Token Usage
When to Use This Skill
Explicit Triggers:
- "Create service token"
- "Setup automation access"
- "Verify services without OAuth"
- "Automated monitoring"
- "Non-human access"
Implicit Triggers:
- Need to test services programmatically
- Setting up monitoring scripts
- CI/CD needs to verify deployments
- Want to share verification results with Claude
- Need to bypass Google OAuth for automation
Debugging Triggers:
- "How do I test services without browser?"
- "How to automate verification?"
- "What's the difference between service tokens and OAuth?"
What This Skill Does
- Explains Tokens - Clarifies service tokens vs Google OAuth use cases
- Creates Token - Guides through Cloudflare dashboard token creation
- Stores Credentials - Adds token to .env securely
- Tests Access - Verifies token works for protected services
- Helper Script - Shows how to use cf-service-token.sh for testing
- Revokes Token - Shows how to revoke/rotate compromised tokens
- Monitors Usage - Shows how to view token usage in Access logs
Instructions
3.1 Understanding Service Tokens vs OAuth
Service Tokens (Non-Human Access):
- For automation, scripts, monitoring systems
- Bypasses Google OAuth requirement
- Works with curl, scripts, CI/CD
- Long-lived (months/years)
- No user session required
Google OAuth (Human Access):
- For humans accessing via web browser
- Requires Google account login
- Session-based (24 hours default)
- Multi-factor authentication support
When to use each:
| Use Case | Method | |
|---|---|---|
| Automated health checks | Service Token | |
| CI/CD deployment verification | Service Token | |
| Monitoring scripts | Service Token | |
| Sharing verification with Claude | Service Token | |
| Human web browser access | Google OAuth | |
| Interactive service use | Google OAuth |
Key difference: Service tokens automatically bypass all Cloudflare Access policies - no additional configuration needed.
3.2 Create Service Token via Dashboard
Step 1: Navigate to Service Auth
- Go to: https://one.dash.cloudflare.com
- Navigate to: Access → Service Auth → Service Tokens
- Click: Create Service Token
Step 2: Configure Token
- Name:
Infrastructure Automation(or descriptive name) - Duration: 1 year (or as needed)
- Recommended: Use descriptive names like "CI/CD Pipeline" or "Health Monitoring"
Step 3: Save Credentials
After creation, Cloudflare shows:
- Client ID:
8f0eb3c52a7236fc952d9b11cd67b960.access - Client Secret:
63b34062dbca3405521196952ba4d155...(long hex string)
⚠️ IMPORTANT: Client secret is shown only once. Copy it immediately.
Step 4: Copy Credentials
Copy both values - you'll add them to .env in the next step.
3.3 Add Credentials to .env
Add service token credentials to project .env file:
Replace values with actual credentials from dashboard.
Verify credentials added:
Expected output:
Security note: .env is already in .gitignore, so credentials won't be committed.
3.4 Test Service Token Access
Test with curl directly:
Expected result:
Test multiple services:
Success indicators:
- HTTP 200: Service accessible and working
- HTTP 502: Service token working but backend down
- HTTP 403: Service token invalid or expired
3.5 Use Helper Script for Verification
The project includes a helper script for easier testing:
Test single service:
Expected output:
Test with full response:
Shows complete HTTP response and headers.
List all service tokens:
Shows all service tokens configured in your Cloudflare account.
Test all configured services:
3.6 Revoke or Rotate Service Token
When to revoke:
- Token compromised or exposed
- Token no longer needed
- Regular security rotation (annually recommended)
Revoke via Dashboard:
- Go to: https://one.dash.cloudflare.com
- Navigate to: Access → Service Auth → Service Tokens
- Find token by name: "Infrastructure Automation"
- Click trash icon → Delete
- Confirm deletion
Revoke via Script:
After revocation:
- Remove credentials from .env:
- If rotating (not removing), create new token and update .env with new credentials.
Token rotation workflow:
3.7 Monitor Service Token Usage
View service token access logs:
Via Cloudflare Dashboard:
- Go to: https://one.dash.cloudflare.com
- Navigate to: Logs → Access
- Filter by: Authentication method → Service token
- View:
- Timestamp of access
- Service accessed
- Token name used
- Source IP
- Success/failure
Log retention: 30 days (free plan) to 6 months (enterprise)
Monitoring for suspicious activity:
- Unexpected IPs accessing services
- High frequency of requests (potential abuse)
- 403 errors (token may be expired/revoked)
Alerts setup (optional):
Set up Cloudflare Notifications:
- Go to: Account → Notifications
- Create alert for: Access events
- Trigger: Service token authentication failures
Supporting Files
| File | Purpose | |
|---|---|---|
references/reference.md | Service token architecture, security best practices, API details | |
scripts/test-service-token.sh | Automated testing script for all services | |
examples/examples.md | Example use cases, monitoring scripts, CI/CD integration |
Expected Outcomes
Success:
- Service token created in Cloudflare dashboard
- Credentials stored securely in .env
- Token bypasses OAuth for protected services
- HTTP 200 responses for accessible services
- Helper script works for verification
- Can share verification results with Claude
Partial Success:
- Token created but not tested (complete step 3.4)
- Some services return 502 (backend issue, not auth issue)
Failure Indicators:
- HTTP 403 responses (token invalid or not configured)
- Token not found in dashboard
- Credentials not in .env
- Helper script fails with "missing credentials"
Requirements
- Cloudflare Zero Trust account with Access configured
- Admin access to Cloudflare dashboard
- .env file with write permissions
- curl installed for testing
- Existing Cloudflare Access applications configured
Red Flags to Avoid
- [ ] Do not treat service tokens like passwords (they are powerful credentials)
- [ ] Do not share service tokens publicly or commit to git
- [ ] Do not create unlimited tokens (1-2 per use case is sufficient)
- [ ] Do not skip saving client secret immediately (shown only once)
- [ ] Do not use service tokens for human browser access (use OAuth)
- [ ] Do not forget to revoke tokens when no longer needed
- [ ] Do not ignore 403 errors (indicates auth failure, not backend issue)
Notes
- Service tokens automatically bypass Cloudflare Access policies (no policy configuration needed)
- Token duration options: 1 day, 1 week, 1 month, 6 months, 1 year, no expiry
- Recommended duration: 1 year with annual rotation
- Service tokens work for all Access-protected applications automatically
- No limit on number of service tokens per account
- Revoked tokens fail immediately (no grace period)
- Service tokens don't support MFA (they bypass all human authentication)
- Use separate tokens for different systems (easier to revoke if compromised)
- Monitor Access logs regularly for unusual service token activity
- cf-service-token.sh script location:
scripts/cf-service-token.sh
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/cloudflare-service-token-setup/SKILL.md
Popularity
- Repository stars
- 1
- 7-day trend score
- 3
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 6 May 2026, 6 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/dawiddutoit/custom-claude/cloudflare-service-token-setup)