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 bash
You must have a developer account and app to use this tool.
xurl auth app --bearer-token BEARER_TOKEN
Note: For OAuth 2.0 authentication, you must specify the redirect URI in the X API developer portal.
- Create an app at the X API developer portal.
- Go to authentication settings and set the redirect URI to
http://localhost:8080/callback
. - Set the client ID and secret in your environment variables.
export CLIENT_ID=your_client_id
export CLIENT_SECRET=your_client_secret
- Get your access keys:
xurl auth oauth2
xurl auth oauth1 --consumer-key KEY --consumer-secret SECRET --access-token TOKEN --token-secret SECRET
View authentication status:
xurl auth status
Clear 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 token
xurl auth clear --bearer # Clear bearer token
Basic GET request:
xurl /2/users/me
Custom HTTP method:
xurl -X POST /2/tweets -d '{"text":"Hello world!"}'
Add headers:
xurl -H "Content-Type: application/json" /2/tweets
Specify authentication type:
xurl --auth oauth2 /2/users/me
xurl --auth oauth1 /2/tweets
xurl --auth app /2/users/me
Use specific OAuth 2.0 account:
xurl --username johndoe /2/users/me
Tokens are stored securely in ~/.xurl
in your home directory.
Run the test suite:
cargo test
Contributions are welcome!
This project is open-sourced under the MIT License - see the LICENSE file for details.