Question

Is there a full flegged python library for oauth? I haven't found any that handle reissuing of oauth tokens once they expire (Step 5 on the Yahoo OAuth flow).

So what is the most complete? I tried the one from oauth.net, and it doesn't handle oauth_session_handle which the oauth spec says is required if the endpoint returns it (like yahoo does).

So, what library should I be using? Are they all incomplete and I have to do it on my own?

Was it helpful?

Solution

I think Leah Culver's python-oauth (that you've already found) is the best starting point even though it's not complete.

Leah has a mirror up on github which would make it easy to collaborate: http://github.com/leah/python-oauth/tree/master/oauth/

Update: As it stands today, it looks like SimpleGeo's python-oauth2 is the best starting point.

OTHER TIPS

Rauth is the new best answer as far as I'm concerned. Wraps requests library and it's well-maintained.

OAuth official website recommends both rauth and oauthlib. Quoting them regarding rauth:

Max Countryman maintains the rauth and it is considered the most up-to-date and unit-tested implementation of OAuth for Python.

Regarding oauthlib:

Another great library is OAuthlib which implements the latest RFC, including client and server.

UPDATE: Feb 9th, 2019

Both libraries are still mentioned in the OAuth recommended libs for Python, but looking at their Github page, oauthlib has been more frequently maintained.

Check out Mike Knapp's library on GitHub. Nice and simple, no install needed. And works on Google App Engine.

Use Kenneth Reitz's awesome requests library along with the requests-oauth plugin linked off of http://docs.python-requests.org/en/latest/community/out-there/

Yet another answer to the 9-year-old question. The following are libraries for OAuth 2.0 and OpenID Connect and sample implementations written in Python. Note that they use Authlete as a backend service.

  1. authlete-python : library for Python (GitHub, PyPI)
  2. authlete-python-django : library for Django (GitHub, PyPI)
  3. django-oauth-server : sample implementation of an authorization server
  4. django-resource-server : sample implementation of a resource server

The question was posted in 2009. Since then, many important specifications have been developed. The following are some examples.

Now the volume of specifications related to OAuth 2.0 and OpenID Connect is huge, full-fledged implementations are rare. For example, at the time of this writing (Aug 20, 2019), the number of certified OpenID Provider implementations that support Financial-grade API (FAPI) is just 4. Also, the number of certified OpenID Provider implementations that support Basic OP, Implicit OP, Hybrid OP, Config OP, Dynamic OP and Form Post OP is 5. (Authlete is the only implementation that is included in both)

The following are some consideration points for OAuth 2.0 implementations:

  1. RFC 7636 support (important for security)
  2. OpenID Connect support (or just OAuth 2.0?)
  3. Financial-grade API (FAPI) support, if you need higher security. See "Financial-grade API (FAPI), explained by an implementer" for technical details.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top