Skip to content

lichman0405/tokenflow

Repository files navigation

TokenFlow

English | 中文

GitHub License

⚠️ WARNING: This library may violate GitHub Copilot's Terms of Service. Using this library to access GitHub Copilot without proper authorization may result in account suspension or termination. This project is for educational and research purposes only. Use at your own risk and ensure you have appropriate authorization before using this library.

Multi-language OAuth2 Device Flow implementation for GitHub Copilot and Hyper services.

📚 Documentation

Language Implementations

Language Directory Documentation
Go go/ English / 中文
Python python/ English / 中文
TypeScript ts/ English / 中文

Features

GitHub Copilot Integration

  • OAuth2 Device Authorization Flow (RFC 8628)
  • Token caching from official Copilot client
  • Custom HTTP client with X-Initiator header injection
  • Token refresh support

Hyper Integration

  • Device authorization flow
  • Token exchange
  • Token introspection (RFC 7662)
  • Configurable base URL via environment variable

Token Management

  • Unified token structure across all implementations
  • Automatic expiration calculation
  • 10% buffer for token refresh
  • JSON serialization support

Security

All implementations include:

  • 30-second HTTP request timeouts
  • 1MB response size limits
  • Token refresh before expiration

Quick Start

Go

cd go
go build ./...

See Go Documentation for detailed usage.

Python

cd python
pip install -e .

See Python Documentation for detailed usage.

TypeScript

cd ts
npm install
npm run build

See TypeScript Documentation for detailed usage.

Author

References

This project is inspired by and references:

License

MIT License