๐ Production Deployment Guide: OAuth Authentication
This guide explains how to deploy the Jira REST API Client in production with OAuth authentication for public multi-user access.
๐ Architecture Overview
Single User Mode (Current Default):
User โ Web App โ Jira API (shared API token)
Multi User Mode (Production OAuth):
User โ OAuth Login โ Jira Account โ User's Own Access Token โ Jira API
๐ Step-by-Step Setup
Step 1: Create Atlassian OAuth App
- Go to Atlassian Developer Console:
- Visit: https://developer.atlassian.com/console/myapps/
- Sign in with your Atlassian account
- Create New App:
- Click โCreateโ โ โOAuth 2.0 integrationโ
- App name: โJira REST API Clientโ (or your preferred name)
- Click โCreateโ
- Configure OAuth Settings:
- Callback URL:
https://your-domain.com/auth/callback
- For local testing:
http://localhost:5000/auth/callback
- Permissions/Scopes:
read:jira-user - Read user profile
read:jira-work - Read issues, projects, etc.
write:jira-work - Create/update issues, comments
- Click โSaveโ
- Get Credentials:
- Copy Client ID
- Copy Client Secret
- Save these securely!
- Update Environment Variables:
# Set application to multi-user mode
APP_MODE=multi_user
# OAuth Configuration
JIRA_OAUTH_CLIENT_ID=your-client-id-from-atlassian
JIRA_OAUTH_CLIENT_SECRET=your-client-secret-from-atlassian
JIRA_OAUTH_REDIRECT_URI=https://your-domain.com/auth/callback
# Remove old single-user settings (optional)
# JIRA_EMAIL= (not needed in multi-user mode)
# JIRA_API_TOKEN= (not needed in multi-user mode)
- Install OAuth Dependencies:
pip install -r requirements.txt
# This now includes: authlib, requests-oauthlib
Step 3: Deploy Application
- Production Deployment Options:
- Heroku:
git push heroku main
- AWS/Azure: Configure environment variables in your cloud provider
- Docker: Set environment variables in container
- VPS: Use systemd service with environment file
- Set Production Environment Variables:
export APP_MODE=multi_user
export JIRA_OAUTH_CLIENT_ID=your-actual-client-id
export JIRA_OAUTH_CLIENT_SECRET=your-actual-client-secret
export JIRA_OAUTH_REDIRECT_URI=https://your-domain.com/auth/callback
export SECRET_KEY=long-random-production-secret-key
๐ Security Benefits
OAuth vs API Token:
| Aspect |
API Token (Single User) |
OAuth (Multi User) |
| User Authentication |
Shared credentials |
Individual Jira accounts |
| Permissions |
Admin-level access |
Userโs actual permissions |
| Security |
One compromised token = full access |
Per-user token isolation |
| Audit Trail |
All actions appear as admin |
Actions appear as actual users |
| Token Management |
Never expires (manual) |
Auto-refresh, can revoke |
Production Security Features:
- โ
No stored passwords - OAuth flow only
- โ
Temporary tokens - Auto-expiring access tokens
- โ
Individual permissions - Users see only what they should
- โ
Revokable access - Users can revoke app access anytime
- โ
CSRF protection - All forms protected
- โ
Session management - Secure session handling
๐ฏ User Experience
For End Users:
- Visit your app โ redirected to Jira login
- Login with their Jira credentials
- Authorize your app (one-time)
- Redirected back to your app
- See only their accessible projects/issues
- Actions recorded under their name
For Administrators:
- No more shared API tokens
- Individual user audit trails
- Standard Jira permission management
- Users can revoke access themselves
๐ง Testing OAuth Flow
Local Testing:
- Set up local OAuth:
export APP_MODE=multi_user
export JIRA_OAUTH_REDIRECT_URI=http://localhost:5000/auth/callback
# Add your client ID/secret
- Update Atlassian App:
- Add
http://localhost:5000/auth/callback to callback URLs
- This allows local testing
- Test Flow:
- Start app:
python web_app.py
- Visit:
http://localhost:5000
- Should redirect to login page
- Click โSign in with Atlassianโ
- Complete OAuth flow
๐ Monitoring & Maintenance
Application Health:
- Monitor OAuth token refresh rates
- Track authentication failures
- Monitor API rate limits per user
- Log user access patterns
User Management:
- Users manage their own access via Atlassian account
- Revoke app access: Atlassian Account Settings โ Connected Apps
- No user database needed in your app
๐จ Migration from Single to Multi-User
If You Have Existing Users:
- Communicate the change - Users need to authenticate individually
- Set
APP_MODE=multi_user - Switches authentication method
- Update documentation - New login process
- Keep old setup route - For emergency admin access if needed
Backward Compatibility:
- App detects
APP_MODE and routes accordingly
- Single user mode still works for internal/personal use
- Can switch back by changing
APP_MODE=single_user
๐ก Production Tips
- OAuth tokens cached in user sessions
- Automatic token refresh handling
- Rate limiting respected per user
Scalability:
- No shared API token rate limits
- Each user has independent rate limits
- Horizontal scaling friendly (stateless sessions)
Compliance:
- User consent flow built-in
- Individual audit trails
- Data access limited to user permissions
- GDPR-friendly (no password storage)
๐ Result: A production-ready, secure, multi-user Jira client that respects individual permissions and provides enterprise-grade authentication!