Skip to content

Instantly share code, notes, and snippets.

@clonn
Last active March 2, 2026 03:16
Show Gist options
  • Select an option

  • Save clonn/06c2f4cfcbd8559ed7de33684bfe0f3b to your computer and use it in GitHub Desktop.

Select an option

Save clonn/06c2f4cfcbd8559ed7de33684bfe0f3b to your computer and use it in GitHub Desktop.
x.com xurl auth update
## X OAuth Local Development Lesson (Important)
I was stuck on this for a long time, so documenting it clearly:
### 1️⃣ You must use `localhost` exactly
The default redirect URI:
```
http://localhost:8080/callback
```
OAuth requires **exact string matching** for `redirect_uri`.
Even small differences will break it:
* ❌ 127.0.0.1 instead of localhost
* ❌ http vs https
* ❌ Missing or extra trailing slash
* ❌ Different port
If it doesn't match exactly what’s configured in X Developer Console, the authorization page will just show:
> “Something went wrong”
(with zero explanation)
---
### 2️⃣ Make sure port 8080 is not already in use
Before testing OAuth locally, check:
```bash
lsof -i :8080
```
If another process is using port 8080, the callback will fail silently.
If it’s occupied:
* Kill the process
* Or change to another port (e.g., 3000)
* And update BOTH:
* The Developer Console redirect URI
* The authorize URL redirect_uri parameter
---
### Key Takeaway
When working with X OAuth locally:
* Exact redirect URI match is mandatory
* Always check port availability
* X error messages are extremely generic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment