Skybox Token Extractor
A Playwright-based service for extracting X-Auth-Tokens from VividSeats Skybox platform.
Features
- Automated login to VividSeats Skybox
- X-Auth-Token extraction from request headers
- RESTful API endpoints
- Docker support for easy deployment
- Health check endpoints
- Comprehensive error handling and logging
API Endpoints
Health Check
GET /health
Returns service health status.
Extract Auth Token
POST /get-auth-token
Content-Type: application/json
{
"email": "your-email@example.com",
"password": "your-password",
"headless": true
}
Returns:
{
"success": true,
"authToken": "extracted-x-auth-token",
"message": "X-Auth-Token extracted successfully"
}
Docker Setup
Prerequisites
- Docker and Docker Compose installed
- Environment variables configured
Environment Variables
Create a .env file in the project root:
VIVIDSEATS_EMAIL=your-email@example.com
VIVIDSEATS_PASSWORD=your-password
NODE_ENV=production
PORT=3000
Build and Run
Using Docker Compose (Recommended)
# Build and start the service
docker-compose up -d
# View logs
docker-compose logs -f
# Stop the service
docker-compose down
The service will be available at http://localhost:3005.
Using Docker directly
# Build the image
docker build -t skybox-token-extractor .
# Run the container
docker run -d \
--name skybox-token-extractor \
-p 3005:3000 \
-e VIVIDSEATS_EMAIL=your-email@example.com \
-e VIVIDSEATS_PASSWORD=your-password \
skybox-token-extractor
# View logs
docker logs -f skybox-token-extractor
# Stop the container
docker stop skybox-token-extractor
docker rm skybox-token-extractor
Development Setup
# Install dependencies
npm install
# Install Playwright browsers
npm run install-browsers
# Start in development mode
npm run dev
Usage Examples
Using curl
# Health check
curl http://localhost:3005/health
# Extract auth token
curl -X POST http://localhost:3005/get-auth-token \
-H "Content-Type: application/json" \
-d '{
"email": "your-email@example.com",
"password": "your-password",
"headless": true
}'
Using the provided client
# Using environment variables
node client.js
# Passing credentials directly
node client.js your-email@example.com your-password
# Run examples
node client.js --example
Configuration
Environment Variables
PORT: Server port (default: 3000)NODE_ENV: Environment mode (development/production)VIVIDSEATS_EMAIL: Default email for authenticationVIVIDSEATS_PASSWORD: Default password for authentication
Docker Configuration
The Dockerfile is optimized for production with:
- Node.js 18 slim base image
- Non-root user for security
- Chromium browser installation
- Health checks
- Multi-stage optimization
Security Considerations
- Always use environment variables for credentials
- Run containers with non-root user (configured by default)
- Use HTTPS in production
- Consider using secrets management for sensitive data
- Monitor logs for failed authentication attempts
Troubleshooting
Common Issues
-
Port already in use
# Change the port mapping in docker-compose.yml
ports:
- "3006:3000" # Use port 3006 instead -
Browser installation fails
# Rebuild with no cache
docker-compose build --no-cache -
Authentication fails
- Verify credentials are correct
- Check if VividSeats has changed their login flow
- Review container logs for detailed error messages
-
Container won't start
# Check logs
docker-compose logs skybox-token-extractor
# Check container status
docker-compose ps
Logs and Debugging
# View real-time logs
docker-compose logs -f skybox-token-extractor
# Execute commands in running container
docker-compose exec skybox-token-extractor /bin/bash
# Debug with non-headless mode (development only)
# Set headless: false in the request body
Monitoring
Health Checks
The service includes built-in health checks:
- Docker health check every 30 seconds
- HTTP endpoint at
/health - Automatic container restart on failure
Metrics
Monitor these key metrics:
- Response time for auth token extraction
- Success/failure rates
- Container resource usage
- Browser process stability
Production Deployment
For production deployment:
- Use a process manager (PM2, systemd)
- Set up proper logging and monitoring
- Configure reverse proxy (nginx)
- Use container orchestration (Docker Swarm, Kubernetes)
- Implement proper secrets management
- Set up automated backups of configuration
Integration
This service is designed to work with the ETL system's AuthTokenService:
// ETL system usage
const authTokenService = new AuthTokenService('http://localhost:3005');
const token = await authTokenService.getAuthToken();