How do I develop against OAuth locally?

后端 未结 7 838
孤独总比滥情好
孤独总比滥情好 2020-12-08 02:38

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

7条回答
  •  清歌不尽
    2020-12-08 03:29

    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 to work).

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

提交回复
热议问题