A command-line tool for interacting with the X (formerly Twitter) API, supporting both OAuth 1.0a and OAuth 2.0 authentication.
- OAuth 2.0 PKCE flow authentication
- OAuth 1.0a authentication
- Multiple OAuth 2.0 account support
- Persistent token storage
- HTTP request customization (headers, methods, body)
curl -fsSL https://raw.githubusercontent.com/xdevplatform/xurl/main/install.sh | sudo bashAdd the following to your environment variables if you want to use OAuth 2.0:
export CLIENT_ID=your_client_id
export CLIENT_SECRET=your_client_secretOptional environment variables:
REDIRECT_URI(default: http://localhost:8080/callback)AUTH_URL(default: https://x.com/i/oauth2/authorize)TOKEN_URL(default: https://api.x.com/2/oauth2/token)API_BASE_URL(default: https://api.x.com)
OAuth 2.0 authentication:
xurl auth oauth2OAuth 1.0a authentication:
xurl auth oauth1 --consumer-key KEY --consumer-secret SECRET --access-token TOKEN --token-secret SECRETView authentication status:
xurl auth statusClear authentication:
xurl auth clear --all # Clear all tokens
xurl auth clear --oauth1 # Clear OAuth 1.0a tokens
xurl auth clear --oauth2-username USERNAME # Clear specific OAuth 2.0 tokenBasic GET request:
xurl /2/users/meCustom HTTP method:
xurl -X POST /2/tweets -d '{"text":"Hello world!"}'Add headers:
xurl -H "Content-Type: application/json" /2/tweetsSpecify authentication type:
xurl --auth oauth2 /2/users/me
xurl --auth oauth1 /2/tweetsUse specific OAuth 2.0 account:
xurl --username johndoe /2/users/meTokens are stored securely in ~/.xurl in your home directory.
The project uses the following structure:
src/main.rs: Entry point and command handlingsrc/auth/: Authentication implementationsrc/api/: API client implementationsrc/cli/: Command-line interface definitionssrc/config/: Configuration managementsrc/error/: Error types and handling
Run the test suite:
cargo testContributions are welcome!
- Fork the repository
- Create your feature branch
- Commit your changes
- Push to the branch
- Create a new Pull Request
This project is open-sourced under the MIT License - see the LICENSE file for details.