forked from claude-did-this/claude-hub
This comprehensive update adds support for Claude Max subscription authentication and improves the overall authentication system with multiple methods: 🔐 Claude Authentication Enhancements: - Add setup container method for Claude Max/20x subscription usage ($20-200/month) - Create interactive authentication script (setup-claude-interactive.sh) - Add authentication testing utility (test-claude-auth.sh) - Support three authentication methods: Setup Container, API Key, AWS Bedrock - Comprehensive authentication documentation 📁 Directory Configuration: - Add CLAUDE_HUB_DIR environment variable (default: ~/.claude-hub) - Update .gitignore to use .claude-hub/ instead of hardcoded paths - Consistent environment variable usage across all scripts 🐙 GitHub Token Support: - Add fine-grained GitHub token support (github_pat_) alongside classic tokens (ghp_) - Update token validation in claudeService and githubService - Enhanced token detection and authentication flow 📖 Documentation & Guides: - Add complete Claude Authentication Guide with all three methods - Add Setup Container Deep Dive documentation - Update CLAUDE.md with quick start authentication section - Comprehensive cost comparison and use case recommendations 🐳 Container & Docker Improvements: - Update Dockerfile.claudecode with proper entrypoint script copying - Add Dockerfile.claude-setup for interactive authentication - Update docker-compose.yml with new port (3003) and environment variables - Enhanced container volume mounting for authentication 🔧 Infrastructure Updates: - Add TRUST_PROXY configuration for reverse proxy environments - Update port configuration from 3002 to 3003 - Enhanced environment variable documentation in .env.example - Debug utilities for troubleshooting authentication issues This update enables Claude Max subscribers to use their existing subscriptions for automation, potentially saving thousands in API costs while maintaining full production capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
91 lines
2.9 KiB
Bash
Executable File
91 lines
2.9 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Test captured Claude authentication
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
AUTH_OUTPUT_DIR="${CLAUDE_HUB_DIR:-$HOME/.claude-hub}"
|
|
|
|
echo "🧪 Testing Claude Authentication"
|
|
echo "================================"
|
|
echo ""
|
|
|
|
if [ ! -d "$AUTH_OUTPUT_DIR" ]; then
|
|
echo "❌ Authentication directory not found: $AUTH_OUTPUT_DIR"
|
|
echo " Run ./scripts/setup/setup-claude-interactive.sh first"
|
|
exit 1
|
|
fi
|
|
|
|
echo "📁 Authentication files found:"
|
|
find "$AUTH_OUTPUT_DIR" -type f | head -20
|
|
echo ""
|
|
|
|
echo "🔍 Testing authentication with Claude CLI..."
|
|
echo ""
|
|
|
|
# Test Claude version
|
|
echo "1. Testing Claude CLI version..."
|
|
docker run --rm \
|
|
-v "$AUTH_OUTPUT_DIR:/home/node/.claude:ro" \
|
|
claude-setup:latest \
|
|
sudo -u node -E env HOME=/home/node PATH=/usr/local/share/npm-global/bin:$PATH \
|
|
/usr/local/share/npm-global/bin/claude --version
|
|
|
|
echo ""
|
|
|
|
# Test Claude status (might fail due to TTY requirements)
|
|
echo "2. Testing Claude status..."
|
|
docker run --rm \
|
|
-v "$AUTH_OUTPUT_DIR:/home/node/.claude:ro" \
|
|
claude-setup:latest \
|
|
timeout 5 sudo -u node -E env HOME=/home/node PATH=/usr/local/share/npm-global/bin:$PATH \
|
|
/usr/local/share/npm-global/bin/claude status 2>&1 || echo "Status command failed (expected due to TTY requirements)"
|
|
|
|
echo ""
|
|
|
|
# Test Claude with a simple print command
|
|
echo "3. Testing Claude with simple command..."
|
|
docker run --rm \
|
|
-v "$AUTH_OUTPUT_DIR:/home/node/.claude:ro" \
|
|
claude-setup:latest \
|
|
timeout 10 sudo -u node -E env HOME=/home/node PATH=/usr/local/share/npm-global/bin:$PATH \
|
|
/usr/local/share/npm-global/bin/claude --print "Hello, testing authentication" 2>&1 || echo "Print command failed"
|
|
|
|
echo ""
|
|
echo "🔍 Authentication file analysis:"
|
|
echo "================================"
|
|
|
|
# Check for key authentication files
|
|
if [ -f "$AUTH_OUTPUT_DIR/.credentials.json" ]; then
|
|
echo "✅ .credentials.json found ($(wc -c < "$AUTH_OUTPUT_DIR/.credentials.json") bytes)"
|
|
else
|
|
echo "❌ .credentials.json not found"
|
|
fi
|
|
|
|
if [ -f "$AUTH_OUTPUT_DIR/settings.local.json" ]; then
|
|
echo "✅ settings.local.json found"
|
|
echo " Contents: $(head -1 "$AUTH_OUTPUT_DIR/settings.local.json")"
|
|
else
|
|
echo "❌ settings.local.json not found"
|
|
fi
|
|
|
|
if [ -d "$AUTH_OUTPUT_DIR/statsig" ]; then
|
|
echo "✅ statsig directory found ($(ls -1 "$AUTH_OUTPUT_DIR/statsig" | wc -l) files)"
|
|
else
|
|
echo "❌ statsig directory not found"
|
|
fi
|
|
|
|
# Look for SQLite databases
|
|
DB_FILES=$(find "$AUTH_OUTPUT_DIR" -name "*.db" 2>/dev/null | wc -l)
|
|
if [ "$DB_FILES" -gt 0 ]; then
|
|
echo "✅ Found $DB_FILES SQLite database files"
|
|
find "$AUTH_OUTPUT_DIR" -name "*.db" | head -5
|
|
else
|
|
echo "❌ No SQLite database files found"
|
|
fi
|
|
|
|
echo ""
|
|
echo "💡 Next steps:"
|
|
echo " If authentication tests pass, copy to your main Claude directory:"
|
|
echo " cp -r $AUTH_OUTPUT_DIR/* ~/.claude/"
|
|
echo " Or update your webhook service to use this authentication directory" |