Skip to content

ubranch/cobalt-token

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cobalt Token

A microservice for securely fetching authentication tokens from Cloudflare services using headless browser automation.

Overview

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.

Features

  • 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

Installation

Prerequisites

  • Node.js 16+
  • pnpm package manager
  • Docker & Docker Compose (for containerized deployment)

Local Setup

  1. Clone the repository:

    git clone https://github.com/yourusername/cobalt-token.git
    cd cobalt-token
  2. Install dependencies:

    pnpm install
  3. Start the server:

    node server.js

Docker Deployment

The project includes Docker configuration for easy deployment:

docker-compose up -d

This will build and start the service on port 59505.

API Usage

Health Check

GET /cobalt-tools/health

Response:

{
  "status": "ok"
}

Get Token

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"
}

Configuration

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 origins
  • NODE_ENV: Environment (development/production)
  • PUPPETEER_EXECUTABLE_PATH: Custom Chrome executable path (optional)

Development

To run the service in development mode with live reloading:

NODE_ENV=development node server.js

License

MIT License

Security Notes

This tool is intended for legitimate API testing and automation purposes. Use responsibly and in compliance with service terms and conditions.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published