Home » Php » php – Twitter App not taking localhost and as CallbackUrl

php – Twitter App not taking localhost and as CallbackUrl

Posted by: admin July 12, 2020 Leave a comment


I am developing an Application on my localhost environment. Where I want to implement Twitter OAuth functionality in PHP. So I just went on dev.twitter.com and was trying to create an app but its not allowing me to pass Callback URL as localhost or

1) Firstly I tried as localhost

Callback URL as localhost

2) Then I tried as localhost/demoproject

Callback URL as localhost with projectname

3) After I tried IP with project name

Callback URL as IPAddress with projectname

But its taking it as a invalid callback/url format.


Is there any way to deal with this?


How to&Answers:

For localhost, use the following URLs in your dev.twitter.com application setup:

Website URL:
Callback URL:

And don’t worry, these are just placeholders, as long as your code sends the correct callback URL when it connects, things ought to work…


You can provide a Valid URL only for developing Twitter app. Local testing it should be

If both are not working, Hope this topic will help you.


Former Twitter Employee’s Answer – see @episod’s post

It turns out that adding a localhost address is not what you should be doing for development anyhow. In the OAuth handshake, your app should provide a callback URL which will override the configured URL on the config page.

The solution is to simply add any URL there as a placeholder.