Twitter app does not accept localhost and 127.0.0.1 as CallbackUrl

I am developing an application in my local environment. Where I want to implement the Twitter OAuth function in PHP. So I just went to dev.twitter.com and tried to create an application, but did not allow me to pass the Callback URL as localhost or 127.0.0.1 .

1) First 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 the project name

Callback URL as IPAddress with projectname

But it accepts it as an invalid / url callback format.

Error

Is there any way to handle this?

thanks

+6
source share
3 answers

For the local host, use the following URLs in the configuration of your dev.twitter.com application:

 Website URL: http://127.0.0.1:8000/twitter/oauth Callback URL: http://127.0.0.1:8000/twitter/oauth 

And don't worry, these are just placeholders, if your code sends the correct callback url when it connects, everything should work ...

+13
source

You can specify a valid URL only for the development of the Twitter application. Local testing should be http://127.0.0.1/folder_name .

If both do not work, hope this topic helps you.

+2
source

Former Twitter employee responder - see @episod post

Turns out adding the localhost address is not what you should do for development. In an OAuth handshake, your application should provide a callback URL that will override the configured URL on the configuration page.

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

0
source

All Articles