- http://django-oauth-toolkit.herokuapp.com/
- https://www.digitalocean.com/community/tutorials/an-introduction-to-oauth-2
- http://cakebaker.42dh.com/2011/01/10/2-legged-vs-3-legged-oauth/
- https://github.com/evonove/django-oauth-toolkit-example
- https://tools.ietf.org/html/rfc6749
- OAuth2 simplified
- OAuth by Sakurity specification of OAuth fixing vulnerabilities.
Last active
April 25, 2017 17:34
-
-
Save gipi/82e1ff0a3e019bb5d91108464df189fb to your computer and use it in GitHub Desktop.
#oauth #authorization
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
from requests_oauthlib import OAuth2Session | |
client_id = 'LZAzNepabqtyGblg6uGhqiknaiDxX0LwTfYa0ZHr' | |
client_secret = '0icSnXkmyBQlZ93hBhj6dkI3DrKEyF5sXTqChkExQ9UxptQVqyAMOrLYc652OD7FRRSzSK2Jkb1q7HfA44adyftTzSD0cKBh1hfbQY4OtbK6bDVRcSLcsWNyiTMD8oxP' | |
redirect_uri = 'https://django-oauth-toolkit.herokuapp.com/consumer/exchange/' | |
oauth = OAuth2Session(client_id, redirect_uri=redirect_uri,) | |
#scope=scope) | |
authorization_url, state = oauth.authorization_url('https://localhost:8000/o/authorize') | |
print 'Please go to %s and authorize access.' % authorization_url | |
authorization_response = raw_input('Enter the full callback URL ') | |
token = oauth.fetch_token( | |
'https://localhost:8000/o/token/', | |
authorization_response=authorization_response, | |
client_secret=client_secret, | |
verify=False) | |
r = oauth.get('https://localhost:8000/api/v2/housedraft/?p=1') | |
print r.content |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment