A Rust-based authentication proxy that allows managing multiple Microsoft accounts for Minecraft, with built-in support for Meteor Client and other Minecraft clients.
Readme made by Claude im to lazy
- Multiple Account Support: Store and manage multiple Microsoft accounts
- Token Caching: Tokens are cached for 23 hours per account (persisted to disk)
- Meteor Client Compatible: Works with Meteor Client without code modifications
- Universal Client Support: Yggdrasil-style API endpoints work with most Minecraft clients
- CLI Management: Easy-to-use command-line interface for configuration
- Secure API Keys: Generate and manage API keys via JSON config
cargo build --release
./target/release/pfandbot-auth setupThis will guide you through:
- Setting bind address and port
- Generating or setting an API key
- Adding your first account
./target/release/pfandbot-auth
# or
./target/release/pfandbot-auth start
# or with custom port
./target/release/pfandbot-auth start --port 8080# Interactive setup
pfandbot-auth setup
# Add a new account
pfandbot-auth add-account
# List all configured accounts
pfandbot-auth list-accounts
# Generate a new API key
pfandbot-auth generate-key
# Start the server
pfandbot-auth start [--port <PORT>]{
"server": {
"host": "0.0.0.0",
"port": 3000
},
"api_keys": [
"your-secret-api-key-here"
]
}[
{
"email": "your_email1@example.com",
"display_name": "Main Account"
},
{
"email": "your_email2@example.com",
"display_name": "Alt Account"
}
]When the server starts, you'll see which accounts are loaded:
Loaded 3 account(s):
[0] Main Account (your_email1@example.com)
[1] Alt Account (your_email2@example.com)
[2] Bot Account (your_email3@example.com)
- Go to the account settings/add account section
- Select "PfandBotAuth" option
- Fill in the fields:
- Username/Email: Enter the account number (e.g.,
0for first account,1for second, etc.) - Password: Enter your API key (e.g.,
your-secret-key-1) - Server: Enter
http://localhost:3000(or your server address)
- Username/Email: Enter the account number (e.g.,
- To use the first account (index 0): Username =
0 - To use the second account (index 1): Username =
1 - To use the third account (index 2): Username =
2
You can also use the HTTP API directly:
# Get token for account 0
curl "http://localhost:3000/token?key=your-secret-key-1&account=0"
# Get token for account 1
curl "http://localhost:3000/token?key=your-secret-key-1&account=1"
# Response format
{
"access_token": "eyJ...",
"uuid": "069a79f4-44e9-4726-a5be-fca90e38aaf5",
"username": "PlayerName"
}On the first request for each account, a browser window will open for Microsoft authentication:
- Sign in with the Microsoft account
- Authorize Minecraft access
- The token will be cached for future use
Subsequent requests will use the cached token until it expires (23 hours).
If you prefer to create config files manually instead of using setup:
- Create
config.jsonwith your settings - Create
accounts.jsonwith your Microsoft accounts - Run
pfandbot-auth start
- Keep your API keys secret - They're in
config.json - Keep your accounts safe -
accounts.jsoncontains email addresses - Token cache -
token_cache.jsoncontains valid access tokens - All sensitive files are in
.gitignoreby default - Consider using HTTPS in production (currently uses HTTP)
- The default bind address
0.0.0.0:3000exposes the server on all interfaces - For production use, consider adding rate limiting and additional security measures
- Make sure you're using the correct account number (0, 1, 2, etc.)
- Verify your API key matches what's in the code
- Check the server is running (
http://localhost:3000)
- Verify the account number exists in your
accounts.json - Remember: accounts are zero-indexed (first account is 0, not 1)
- Check that the Microsoft account email is correct in
accounts.json - Ensure you have a browser installed and accessible
- Check the console for error messages
- Axum: Web framework
- Azalea-auth: Microsoft authentication handling
- Tokio: Async runtime
- Serde: JSON serialization
The server implements two authentication methods:
- Simple HTTP GET endpoint (
/token) for direct API access - Yggdrasil-style POST endpoint (
/api/yggdrasil/authserver/authenticate) for Minecraft client compatibility