tags:

views:

592

answers:

4

I'm building a Python application that needs to communicate with an OAuth service provider. The SP requires me to specify a callback URL. Specifying localhost obviously won't work. I'm unable to set up a public facing server. Any ideas besides paying for server/hosting? Is this even possible?

A: 

This may help you:

http://www.marcworrell.com/article-2990-en.html

It's php so should be pretty straightforward to set up on your dev server.

I've tried this one once:

http://term.ie/oauth/example/

It's pretty simple. You have a link to download the code at the bottom.

Vasil
+5  A: 

Two things:

  1. The OAuth Service Provider in question is violating the OAuth spec if it's giving you an error if you don't specify a callback URL. callback_url is spec'd to be an OPTIONAL parameter.

  2. But, pedantry aside, you probably want to get a callback when the user's done just so you know you can redeem the Request Token for an Access Token. Yahoo's FireEagle developer docs have lots of great information on how to do this.

Even in the second case, the callback URL doesn't actually have to be visible from the Internet at all. The OAuth Service Provider will redirect the browser that the user uses to provide his username/password to the callback URL.

The two common ways to do this are:

  1. Create a dumb web service from within your application that listens on some port (say, http://localhost:1234/) for the completion callback, or
  2. Register a protocol handler (you'll have to check with the documentation for your OS specifically on how to do such a thing, but it enables things like <a href="skype:555-1212"> to work).

(An example of the flow that I believe you're describing lives here.)

sblom
A: 

You could create 2 applications? 1 for deployment and the other for testing.

Alternatively, you can also include an oauth_callback parameter when you requesting for a request token. Some providers will redirect to the url specified by oauth_callback (eg. Twitter, Google) but some will ignore this callback url and redirect to the one specified during configuration (eg. Yahoo)

seanlinmt