Localhost callback url for OAuth1 is "invalid website url"


On the Twitter developer interface this is what I get when I try to use a localhost url for callback.

This was ok on the previous interface (the one that is shown as soon deprecated: apps.twitter.com)

How do you manage to test Twitter OAuth locally with this?


There are few ways around it:

  1. Use IP address
  2. Create a fake domain for testing and resolve it locally on your machine
  3. Register your own testing domain
  4. Have subdomain for testing: e.g local.yourrealdomain.com (I personally use this, works well for ssl too)
  5. Use the legacy interface for now, and hope that twitter will fix the new interface before depreciation :slight_smile:


Thank you @Connexinet!

But this looks like a recurring problem, how is this not handled properly by Twitter while so many developers are complaining? What you suggested works, but here are my concerns:

  • instead of localhost works but I work with localhost, not and I don’t want to adapt my code for Twitter only
  • Creating fake hosts works too but if I work on many projects on many computers this is a pain
  • Using a real domain will help only if I already have a domain available
  • The legacy interface has been disabled last month, I was using it until now


I don’t know why they haven’t fixed it, may be because we have been using workarounds :slight_smile:

  1. Not sure why you would need to adapt your code, ideally one shouldn’t hardcode the IP or domain in the code, but if you have good reasons you can use the other workarounds
  2. Yeah I hear you
  3. True, but it only costs $10 to get a domain, not huge deal tbh
  4. Only disabled to create new apps, so you can create the app in the new interface and edit in the old one (yeah, it’s a bit of a pain, but hopefully they fix it before full deprecation)

  1. Actually I sometimes need to set some urls in my config files, as locally I could have multiple Docker containers for multiple purposes, some addresses (or at least ports) may need to be set

  2. That may be an idea!! Thanks for the advice :slight_smile:

  3. Omg you are right! That’s great :joy:

Thanks again @Connexinet!


my pleasure!


One note on point #4 in @Connexinet’s latest response - You can edit apps in the new interface if you have applied for a new account. You can also do so on apps.twitter.com

You can read more about that here.


Hi @LeBraat,
Yes, but the problem is that editing in the new interface when you have a dev account is kinda broken (doesn’t allow localhost).
Would be great if you guys can fix it.



Noted. Thank you for pointing this out. I have a message into our product team related to this. I will make sure to update this topic as the conversation progresses.