9.5 KiB
Jira Authentication Guide
Overview
The Jira integration uses Basic Authentication with API tokens to securely access Jira Cloud. This document covers setup, security best practices, and troubleshooting.
Authentication Method
Jira Cloud REST API v3 uses Basic Authentication:
Authorization: Basic base64(email:api_token)
NOT username/password (deprecated and insecure).
Setup Instructions
Step 1: Generate API Token
- Log in to your Atlassian account
- Visit: https://id.atlassian.com/manage-profile/security/api-tokens
- Click "Create API token"
- Give it a name (e.g., "PRISM Local Development")
- Copy the generated token (you won't see it again!)
Step 2: Configure Environment Variables
-
Navigate to your project repository root
-
Copy the example environment file:
cp .env.example .env -
Edit
.envand add your credentials:JIRA_EMAIL=your.email@resolve.io JIRA_API_TOKEN=your_generated_api_token_here -
Verify
.envis in.gitignore(it should be!)
Step 3: Verify Configuration
Test your credentials:
# Unix/Linux/Mac
curl -u $JIRA_EMAIL:$JIRA_API_TOKEN \
https://resolvesys.atlassian.net/rest/api/3/myself
# Windows PowerShell
$env:JIRA_EMAIL
$env:JIRA_API_TOKEN
curl.exe -u "${env:JIRA_EMAIL}:${env:JIRA_API_TOKEN}" `
https://resolvesys.atlassian.net/rest/api/3/myself
Expected Response: JSON with your user details Error Response: 401 Unauthorized (check credentials)
core-config.yaml Configuration
The Jira configuration in core-config.yaml:
jira:
enabled: true
baseUrl: https://resolvesys.atlassian.net
email: ${JIRA_EMAIL}
token: ${JIRA_API_TOKEN}
defaultProject: PLAT
issueKeyPattern: "[A-Z]+-\\d+"
Field Descriptions:
enabled: Master switch for Jira integrationbaseUrl: Your Jira Cloud instance URLemail: Environment variable reference for emailtoken: Environment variable reference for API tokendefaultProject: Default project key for issue detectionissueKeyPattern: Regex pattern for detecting issue keys
Placeholders (${VARIABLE}):
- Automatically replaced with environment variable values
- Keeps secrets out of version control
- Allows per-developer configuration
Security Best Practices
✅ DO
Store Credentials Securely:
- Use environment variables (
JIRA_EMAIL,JIRA_API_TOKEN) - Use
.envfile for local development (gitignored) - Use secure secrets management for production (if applicable)
Protect API Tokens:
- Treat API tokens like passwords
- Never commit to version control
- Rotate tokens periodically (every 90 days recommended)
- Use descriptive token names (e.g., "PRISM Dev - John Laptop")
- Revoke unused tokens immediately
Limit Token Scope:
- Use account with read-only Jira access if possible
- Create dedicated "service account" for integrations
- Request minimum necessary permissions
In Code:
- Never hardcode credentials in source files
- Never embed credentials in URLs (
https://user:pass@domain.com) - Use WebFetch tool which handles auth headers securely
- Never log credentials in debug output
❌ DON'T
Never:
- Commit
.envfile to git - Hardcode credentials in code
- Share API tokens in chat, email, or docs
- Use passwords (use API tokens only)
- Embed credentials in URLs
- Log credentials in debug output
- Share credentials between developers (each gets their own)
Avoid:
- Using personal accounts for shared integrations
- Storing tokens in plaintext outside
.env - Reusing tokens across multiple projects
- Leaving old tokens active after switching machines
WebFetch Authentication
Claude Code's WebFetch tool handles authentication automatically:
How It Works
- WebFetch reads
core-config.yaml - Resolves
${JIRA_EMAIL}and${JIRA_API_TOKEN}from environment - Constructs
Authorization: Basic base64(email:token)header - Includes header in all Jira API requests
- Credentials never exposed in logs or output
Usage Example
// You don't need to handle auth manually!
WebFetch({
url: "https://resolvesys.atlassian.net/rest/api/3/issue/PLAT-123",
prompt: "Extract issue details"
})
// WebFetch automatically:
// 1. Reads JIRA_EMAIL and JIRA_API_TOKEN from env
// 2. Adds Authorization header
// 3. Makes authenticated request
What You Don't Need to Do
❌ Don't do this (WebFetch handles it):
// WRONG - Don't manually construct auth
const auth = btoa(`${email}:${token}`);
const headers = { Authorization: `Basic ${auth}` };
✅ Do this (let WebFetch handle it):
// RIGHT - Just provide the URL
WebFetch({ url: jiraUrl, prompt: "..." })
Environment Variable Loading
Local Development
.env File (in repository root):
# Jira Integration
JIRA_EMAIL=john.doe@resolve.io
JIRA_API_TOKEN=ATATT3xFfGF0abc123xyz...
# Other services
GITHUB_TOKEN=ghp_abc123...
Loading Priority:
- System environment variables (if set)
.envfile in current directory.envfile in parent directories (searches up)
dotenv Support: PRISM uses dotenv-style loading. Ensure your environment supports it.
CI/CD / Production
For automated environments:
GitHub Actions:
env:
JIRA_EMAIL: ${{ secrets.JIRA_EMAIL }}
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
Docker:
docker run \
-e JIRA_EMAIL=$JIRA_EMAIL \
-e JIRA_API_TOKEN=$JIRA_API_TOKEN \
your-image
AWS/Cloud: Use secure secrets management (AWS Secrets Manager, etc.)
Troubleshooting
401 Unauthorized
Symptoms:
- "Invalid credentials" error
- API returns 401 status code
Causes:
- Incorrect email address
- Incorrect or expired API token
- Token revoked in Atlassian account
- Using password instead of API token
Solutions:
- Verify
JIRA_EMAILmatches your Atlassian account email - Generate new API token and update
.env - Check token is active at https://id.atlassian.com/manage-profile/security/api-tokens
- Ensure using API token, not password
403 Forbidden
Symptoms:
- "Access denied" error
- API returns 403 status code
Causes:
- Account lacks permission to view issue
- Issue in restricted project
- Account lacks Jira license
Solutions:
- Verify you can view the issue in Jira web UI
- Request access to the project from Jira admin
- Ensure account has Jira Software license
Environment Variables Not Found
Symptoms:
${JIRA_EMAIL}not replaced in config- Undefined variable errors
Causes:
.envfile missing.envin wrong location- Environment variables not exported
- Typo in variable names
Solutions:
- Create
.envfile in repository root - Verify
.envcontainsJIRA_EMAIL=...andJIRA_API_TOKEN=... - Restart terminal/IDE to reload environment
- Check variable names match exactly (case-sensitive)
Test Variables:
# Unix/Linux/Mac
echo $JIRA_EMAIL
echo $JIRA_API_TOKEN
# Windows PowerShell
echo $env:JIRA_EMAIL
echo $env:JIRA_API_TOKEN
# Windows CMD
echo %JIRA_EMAIL%
echo %JIRA_API_TOKEN%
Rate Limiting (429)
Symptoms:
- "Rate limit exceeded" error
- API returns 429 status code
Causes:
- Too many requests in short time
- Exceeded 300 requests/minute limit
Solutions:
- Wait 60 seconds before retrying
- Implement session caching to reduce duplicate requests
- Batch operations when possible
Permissions Required
Minimum Jira Permissions:
- Browse Projects: View issues in project
- View Issues: Read issue details
- View Comments: Read issue comments
NOT Required:
- Create/Edit issues (read-only integration)
- Assign issues
- Transition issues
- Admin permissions
Recommended Setup:
- Use account with "Jira Software" license
- Ensure access to all projects you need to integrate
- Consider dedicated "integration" account for team use
Token Management
Rotation Schedule
Recommended:
- Rotate tokens every 90 days
- Rotate immediately if:
- Token potentially exposed
- Developer leaves team
- Device lost or stolen
Rotation Process:
- Generate new token in Atlassian
- Update
.envwith new token - Test integration
- Revoke old token in Atlassian
- Document rotation in team wiki
Multiple Tokens
You can create multiple tokens for different purposes:
Example:
- "PRISM Dev - Laptop" (local development)
- "PRISM Dev - Desktop" (work machine)
- "PRISM CI/CD" (automated testing)
Benefits:
- Revoke specific token without affecting others
- Identify which integration is making requests
- Isolate security incidents
Team Collaboration
Individual Credentials
Each developer should:
- Generate their own API token
- Configure their own
.envfile - Never share tokens with teammates
Why:
- Audit trail (know who accessed what)
- Security (revoke individual access)
- Accountability (track API usage per person)
Shared Documentation
Team wiki should include:
- Link to this authentication guide
- Link to generate API tokens
- Where to put
.envfile - Who to contact for access issues
- Jira projects available for integration
Do NOT include:
- Actual API tokens
- Actual email/password combinations
- Shared credentials