A microservice for securely fetching authentication tokens from Cloudflare services using headless browser automation.
Cobalt Token is a service that automates the process of obtaining authentication tokens by simulating a real browser session. It uses Puppeteer with stealth plugins to bypass anti-bot measures and fetch valid tokens that can be used for API authentication.
- Token generation with configurable parameters
- Rate-limited API to prevent abuse
- Docker containerization for easy deployment
- CORS support for web applications
- JWT handling for secure token management
- Anti-detection mechanisms using puppeteer-stealth
- Node.js 16+
- pnpm package manager
- Docker & Docker Compose (for containerized deployment)
-
Clone the repository:
git clone https://github.com/yourusername/cobalt-token.git cd cobalt-token
-
Install dependencies:
pnpm install
-
Start the server:
node server.js
The project includes Docker configuration for easy deployment:
docker-compose up -d
This will build and start the service on port 59505.
GET /cobalt-tools/health
Response:
{
"status": "ok"
}
GET /cobalt-tools/api/v1/token
Response:
{
"status": "success",
"token": "your-authentication-token",
"timestamp": "2023-01-01T00:00:00.000Z",
"expiresAt": "2023-01-01T01:00:00.000Z"
}
Error Response:
{
"status": "error",
"error": "Error message",
"timestamp": "2023-01-01T00:00:00.000Z"
}
The service can be configured through environment variables:
PORT
: Server port (default: 59505)HOST
: Server host (default: 0.0.0.0)ALLOWED_ORIGINS
: CORS allowed originsNODE_ENV
: Environment (development/production)PUPPETEER_EXECUTABLE_PATH
: Custom Chrome executable path (optional)
To run the service in development mode with live reloading:
NODE_ENV=development node server.js
This tool is intended for legitimate API testing and automation purposes. Use responsibly and in compliance with service terms and conditions.