Alex Rivera | Logout

Twitter oAuth callbackUrl - localhost development

Asked 2009-04-29T04:04:28.560
115

Is anyone else having a difficult time getting Twitters oAuth's callback URL to hit their localhost development environment. Apparently it has been disabled recently. http://code.google.com/p/twitter-api/issues/detail?id=534#c1

Does anyone have a workaround. I don't really want to stop my development

Edit
Report

2 Answers

7

Use http://smackaho.st

What it does is a simple DNS association to 127.0.0.1 which allows you to bypass the filters on localhost or 127.0.0.1 :

smackaho.st. 28800 IN A 127.0.0.1

So if you click on the link, it will display you what you have on your local webserver (and if you don't have one, you'll get a 404). You can of course set it to any page/port you want :

http://smackaho.st:54878/twitter/callback

answered 2011-09-20T19:27:19.497
3

When I develop locally, I always set up a locally hosted dev name that reflects the project I'm working on. I set this up in xampp through xampp\apache\conf\extra\httpd-vhosts.conf and then also in \Windows\System32\drivers\etc\hosts.

So if I am setting up a local dev site for example.com, I would set it up as example.dev in those two files.

Short Answer: Once this is set up properly, you can simply treat this url (http://example.dev) as if it were live (rather than local) as you set up your Twitter Application.

A similar answer was given here: https://dev.twitter.com/discussions/5749

Direct Quote (emphasis added):

You can provide any valid URL with a domain name we recognize on the application details page. OAuth 1.0a requires you to send a oauth_callback value on the request token step of the flow and we'll accept a dynamic locahost-based callback on that step.

This worked like a charm for me. Hope this helps.

answered 2013-05-22T22:03:16.717

Your Answer