Complete guide to setting up secure authentication with Confluence Cloud using OAuth 2.0.
The MCP Confluence ADF server uses OAuth 2.0 for secure, token-based authentication with Confluence Cloud. This provides:
Secure Access : No need to store passwords or API keys
Scoped Permissions : Access only what your app needs
Automatic Refresh : Tokens refresh automatically
Revocable Access : Can be revoked from Atlassian account settings
Confluence Cloud instance (not Server/Data Center)
Atlassian Account with admin access to your Confluence
Developer Console Access to create OAuth apps
Step 1: Create OAuth App in Atlassian Developer Console
Access Developer Console
Sign in with your Atlassian account
Click your profile icon → "Developer console"
Enter app name: "Claude Code MCP Server" (or your preferred name)
In your app, click "Authorization" in left menu
Next to "OAuth 2.0 (3LO)" , click "Configure"
Enter Callback URL : http://localhost:9000/oauth/callback
Add Required Permissions
Click "Permissions" in left menu
Next to "Confluence API" , click "Add"
Select these required scopes :
Essential Scopes
Additional Scopes (Recommended)
Click "Save" after adding all scopes
Get Your Credentials
Click "Settings" in left menu
Copy your Client ID and Client Secret
Keep these secure - you'll need them for authentication
Step 2: Initialize OAuth in Claude Code
Start Authentication Flow
In Claude Code, run:
Or use the tool directly:
Expected Response:
Complete Authorization
Continue with:
Or:
Step 3: Browser Authorization Flow
Authorization Process
Browser Opens to Atlassian authorization page
Sign In to your Atlassian account (if not already signed in)
Review App Permissions :
Requested scopes/permissions
Which Confluence sites it can access
Click "Accept" to grant permissions
Automatic Redirect back to callback server
Success Page displays "Authentication Successful!"
Browser tab closes automatically
What Happens During Authorization
PKCE Security : Uses Proof Key for Code Exchange for enhanced security
State Parameter : Prevents CSRF attacks
Secure Token Exchange : Authorization code exchanged for access tokens
Local Storage : Tokens stored securely on your machine
Step 4: Verify Authentication
Expected Output:
Test Connection
If authentication is working, you'll see your accessible Confluence spaces.
Token Management
Automatic Token Refresh
Access tokens expire after 1 hour
Refresh tokens are used automatically to get new access tokens
No user intervention required for token refresh
Refresh tokens expire after 90 days of inactivity
Token Storage Security
macOS : Keychain Access
Stored in system keychain
Access controlled by macOS
Windows : Credential Manager
Windows Credential Manager
Linux : File-based with permissions
Stored in ~/.mcp/confluence-adf/oauth-tokens.json
File permissions: 600 (owner read/write only)
JSON format with encrypted sensitive data
Managing Tokens
Check Token Status
Clear/Reset Authentication
This will:
Require re-authentication for next use
Troubleshooting Authentication
1. "Invalid Client" Error
Cause : Client ID or secret incorrect Solution : Verify credentials from Developer Console
2. "Redirect URI Mismatch"
Cause : Callback URL doesn't match app configuration Solution : Ensure callback URL in app matches http://localhost:9000/oauth/callback
3. "Insufficient Scope" Error
Cause : Missing required OAuth scopes Solution : Add all required scopes in Developer Console
4. "Site Access Denied"
Cause : App doesn't have access to your Confluence site Solution :
Check site admin settings
Ensure your account has appropriate permissions
5. Browser Doesn't Open
Cause : System browser configuration Solution :
Copy authorization URL manually
Paste in browser to complete flow
6. Tokens Expired
Cause : Refresh token expired (90 days inactive) Solution : Re-run authentication flow
Debugging Steps
Verify App Configuration :
Client ID and secret correct
All required scopes added
Test Network Connectivity :
Security Best Practices
App Configuration
Use descriptive app names that identify their purpose
Request minimal scopes needed for functionality
Regular review of app permissions in Atlassian account
Never share client secrets or tokens
Rotate credentials periodically (create new app if needed)
Monitor access in Atlassian account security settings
Revoke unused apps from account settings
Development vs Production
Separate apps for development and production use
Different callback URLs for different environments
Environment-specific credentials
Advanced Configuration
Custom Callback Port
If port 9000 is unavailable:
Update your app's callback URL to match.
Multiple Confluence Instances
For multiple Confluence clouds:
Create separate OAuth apps for each instance
Use different client credentials for each
Authenticate separately for each instance
Headless Authentication
For server environments without browsers:
Generate authorization URL on development machine
Complete authorization flow manually
Export/import tokens to server environment
API Rate Limits
Confluence Cloud API has rate limits:
Standard : 10 requests per second per app
Burst : Up to 100 requests in short periods
Daily : 10,000 requests per day per app
The MCP server handles rate limiting automatically:
Request queuing and throttling
Exponential backoff on rate limit errors
Automatic retry with appropriate delays
Once authentication is complete:
Last updated 4 months ago