AgentAuth
AgentAuth is a Python package that helps automate web authentication by simulating human-like login behavior. It supports various authentication methods including:
- Standard username/password login
- Time-based One-Time Passwords (TOTP)
- Email magic links
- Email verification codes
Features
- 🤖 Automated Authentication: Handles complex login flows automatically
- 📧 Email Integration: Supports email-based verification (magic links and codes)
- 🔐 Password Manager Integration: Works with 1Password, Bitwarden, and local credential storage
- 🌐 Browser Integration: Compatible with remote CDP-based browsers
Installation
pip install agentauth
Quick Start
from agentauth import AgentAuth, CredentialManager
# Add credentials to a new credential manager
credential_manager = CredentialManager()
credential_manager.load_credential({
"website": "https://www.example.com",
"username": "user@example.com",
"password": "user_password"
})
# Create an instance of AgentAuth with access to credentials
aa = AgentAuth(credential_manager=credential_manager)
# Authenticate to a website for a given username
cookies = await aa.auth("https://www.example.com", "user@example.com")
# User is logged in! 🎉
# Use cookies for authenticated agent actions... (see examples directory to see how)
ℹ️ You can pass a custom LLM to the AgentAuth constructor. OpenAI's gpt-4o is the default and requires an OPENAI_API_KEY environment variable.
Connecting an email inbox
Many websites require an email step to authenticate. This could be for a magic link or login code, or it could be for email-based two-factor authentication. AgentAuth supports connecting an email inbox to handle these cases.
aa = AgentAuth(
imap_server="imap.example.com",
imap_username="agent@example.com",
imap_password="agent_email_password"
)
cookies = await aa.auth("https://www.example.com", "agent@example.com")
Loading credentials from various sources
from agentauth import AgentAuth, CredentialManager
# Create a new credential manager
credential_manager = CredentialManager()
# Load credentials from 1Password
credential_manager.load_1password(os.getenv("OP_SERVICE_ACCOUNT_TOKEN"))
# Load credentials from Bitwarden
credential_manager.load_bitwarden(
os.getenv("BW_CLIENT_ID"),
os.getenv("BW_CLIENT_SECRET"),
os.getenv("BW_MASTER_PASSWORD")
)
# Load credentials from a file
credential_manager.load_file("credentials.json")
# Load a single credential
credential_manager.load_credential({
"website": "https://www.example.com",
"username": os.getenv("USERNAME"),
"password": os.getenv("PASSWORD")
})
# Load a list of credentials
credential_manager.load_credentials([
{
"website": "https://www.example.com",
"username": os.getenv("EXAMPLE_USERNAME"),
"password": os.getenv("EXAMPLE_PASSWORD")
},
{
"website": "https://www.fakewebsite.com",
"username": os.getenv("FAKEWEBSITE_USERNAME"),
"password": os.getenv("FAKEWEBSITE_PASSWORD")
}
])
To Do
- Add automatic publishing to PyPI
- Support local S/LLM for email scanning
- Add support for other password managers
Contributing
Contributions are welcome! Please feel free to submit a pull request.
License
This project is licensed under the MIT License.
Metadata
Release files for agentauth 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentauth-0.4.0.tar.gz | 114.9 kB | Without provenance | Details for agentauth-0.4.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentauth-0.4.0-py3-none-any.whl | Python 3 | none | any | Details for agentauth-0.4.0-py3-none-any.whl |
Total release size: 127.0 kB
Release files / agentauth-0.4.0.tar.gz
| Download URL | agentauth-0.4.0.tar.gz |
|---|---|
| Size | 114.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d971688e1c80fb93298a89e9f07e2fec03e63931d897ab0f318553854df5a104
|
|
BLAKE2b-256 checksum How to use checksums |
838a1a0e54c14a6952230e72a263a7e7040c272958b53951c59a035f3d037b47
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Release files / agentauth-0.4.0-py3-none-any.whl
| Download URL | agentauth-0.4.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1c6c3ef5ec06cfe8c44f89e0ffa51ce85461593d8936f951c948ea316e74c8d3
|
|
BLAKE2b-256 checksum How to use checksums |
6ef6f1008d1fcf0f2d3555e5c65df030eeaccc868d5fb6c1f8c7d289e8daabbf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.5.29
|
Security for agentauth 0.4.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.