A sanitized, open-source starter for email-based account registration flows, OTP retrieval, OAuth/PKCE token exchange, token inventory management, and credential validation.
This repository is a best-practice refactor and documentation-first open-source extraction from a private automation project. It intentionally removes private infrastructure details, real credentials, and project-specific downstream integrations.
auto_register is a modular Python project for building registration pipelines that typically need:
- disposable or catch-all email addresses
- OTP polling from inbox providers
- browser-like HTTP requests
- OAuth + PKCE callback parsing and token exchange
- token file persistence
- inventory-driven replenishment
- periodic credential validation and cleanup
It is designed as a framework/starter repo, not as a hardcoded single-purpose script.
This public repo does not include:
- private mailbox credentials
- private domains
- private filesystem paths
- private downstream project names/locations
- private token archives
- personal server topology
Anything sensitive has been replaced with:
- environment variables
- generic placeholders
- example configs
- portable relative paths
auto_register/
├── README.md
├── requirements.txt
├── .gitignore
├── .env.example
├── domains.example.txt
├── ecosystem.config.example.js
├── docs/
│ ├── architecture.md
│ ├── flow-overview.md
│ ├── sanitization-notes.md
│ └── downstream-integration.md
├── src/
│ └── auto_register/
│ ├── __init__.py
│ ├── config.py
│ ├── models.py
│ ├── oauth.py
│ ├── storage.py
│ ├── utils.py
│ ├── providers/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── imap_provider.py
│ │ ├── mailtm_provider.py
│ │ └── mailgw_provider.py
│ ├── flows/
│ │ ├── __init__.py
│ │ ├── register_flow.py
│ │ └── validate_flow.py
│ └── cli/
│ ├── __init__.py
│ ├── register.py
│ └── validate.py
└── tests/
└── test_config.py
Email backends are pluggable. The registration pipeline should not depend on a single inbox vendor.
Registration and token acquisition are separated into two logical phases:
- Phase 1: create account
- Phase 2: new session / login / token exchange
This structure is cleaner architecturally and also makes the codebase easier to maintain and test.
Instead of endlessly creating credentials, the runner can maintain a healthy inventory size.
Credential production and credential validation are independent concerns and should run separately.
git clone git@github.com:leecaa/auto_register.git
cd auto_registerpython3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtcp .env.example .env
cp domains.example.txt domains.txtEdit .env with your own values.
PYTHONPATH=src python -m auto_register.cli.register --provider imap --oncePYTHONPATH=src python -m auto_register.cli.validate --onceSee .env.example for the full list.
Important ones:
AUTO_REGISTER_AUTH_DIRAUTO_REGISTER_DOMAINS_FILEAUTO_REGISTER_IMAP_HOSTAUTO_REGISTER_IMAP_PORTAUTO_REGISTER_IMAP_USERAUTO_REGISTER_IMAP_PASSAUTO_REGISTER_MAILTM_BASEAUTO_REGISTER_MAILGW_BASEAUTO_REGISTER_REQUEST_TIMEOUT
- portable
- documented
- safe to publish
- easy to fork
- easy to swap providers
- easy to connect to a downstream credential consumer
- Replace example providers with your real providers.
- Implement your own target registration flow in
flows/register_flow.py. - Connect validation to your own downstream credential checker.
- Add unit tests for provider behavior and callback parsing.
- Set up PM2/systemd/Docker only after local testing passes.
This repository is provided as a general-purpose automation and architecture example. You are responsible for ensuring your use complies with the policies, terms, and laws applicable to your target systems.