1. Developer portal Create a project and app at developer.x.com.
2. OAuth 2.0
- Type: Web App (confidential client)
- Callback URL: `{NEXTAUTH_URL}/api/auth/twitter/callback`
- Enable OAuth 2.0 with PKCE
3. Scopes
- `tweet.read`
- `tweet.write`
- `users.read`
- `offline.access`
4. Access level Posting requires elevated access on X's API. Apply for the appropriate tier in the developer portal.
5. Environment variables ``` TWITTER_CLIENT_ID=your_client_id TWITTER_CLIENT_SECRET=your_client_secret NEXTAUTH_URL=https://app.goals.ac ```