Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

readme changes #9

Merged
merged 1 commit into from
Jan 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 12 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,40 @@ A command-line tool for interacting with the X (formerly Twitter) API, supportin
curl -fsSL https://raw.githubusercontent.com/xdevplatform/xurl/main/install.sh | sudo bash
```

## Configuration

Add the following to your environment variables if you want to use OAuth 2.0:

```env
export CLIENT_ID=your_client_id
export CLIENT_SECRET=your_client_secret
```

Optional 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)

## Usage

### Authentication

You must have a developer account and app to use this tool.

App authentication:
#### App authentication:
```bash
xurl auth app --bearer-token BEARER_TOKEN
```

OAuth 2.0 authentication:
```bash
xurl auth oauth2
```

#### OAuth 2.0 User-Context
**Note:** For OAuth 2.0 authentication, you must specify the redirect URI in the [X API developer portal](https://developer.x.com/en/portal/dashboard).

1. Create an app at the [X API developer portal](https://developer.x.com/en/portal/dashboard).
2. Go to authentication settings and set the redirect URI to `http://localhost:8080/callback`.
![Setup](./assets/setup.png)
![Redirect URI](./assets/callback.png)
3. Set the client ID and secret in your environment variables.

OAuth 1.0a authentication:
```env
export CLIENT_ID=your_client_id
export CLIENT_SECRET=your_client_secret
```
4. Get your access keys:
```bash
xurl auth oauth2
```
#### OAuth 1.0a authentication:
```bash
xurl auth oauth1 --consumer-key KEY --consumer-secret SECRET --access-token TOKEN --token-secret SECRET
```

### Authentication Management
View authentication status:
```bash
xurl auth status
Expand Down
Loading