title: OAuth2 Client (Python/Django)
body: <p>I'm creating a single sign-on (SSO) service using Python, Django, Django Rest Framework and Django OAuth Toolkit (<a href="https://github.com/evonove/django-oauth-toolkit" rel="nofollow noreferrer">https://github.com/evonove/django-oauth-toolkit</a>). The SSO service will be a central, stand-alone application providing user identity services (granting access to user information as an OAuth2 Protected Resource).</p>
  <p>Django OAuth Toolkit  helps to implement the OAuth2 Authorisation Server. Is there a similarly good quality Django or Python library that can help in implementing the OAuth2 Client (see following diagram snippet taken from <a href="https://www.rfc-editor.org/rfc/rfc6749#section-1.2" rel="nofollow noreferrer">https://www.rfc-editor.org/rfc/rfc6749#section-1.2</a>)?</p>
  <pre><code>+--------+                               +---------------+
  |        |--(A)- Authorization Request -&gt;|   Resource    |
  |        |                               |     Owner     |
  |        |&lt;-(B)-- Authorization Grant ---|               |
  |        |                               +---------------+
  |        |
  |        |                               +---------------+
  |        |--(C)-- Authorization Grant --&gt;| Authorization |
  | Client |                               |     Server    |
  |        |&lt;-(D)----- Access Token -------|               |
  |        |                               +---------------+
  |        |
  |        |                               +---------------+
  |        |--(E)----- Access Token ------&gt;|    Resource   |
  |        |                               |     Server    |
  |        |&lt;-(F)--- Protected Resource ---|               |
  +--------+                               +---------------+
  </code></pre>
  <p>(I expect the main use case wouldn't be a problem to implement myself, but if a good library provides handling of corner cases, errors, retries and is well tested, then it would be a shame to reinvent.)</p>
  <p>Thanks,</p>
  <p>Paul.</p>