https://github.com/kstrauser/pythonoauthcallback
A local webserver for answering OAuth callbacks on localhost
https://github.com/kstrauser/pythonoauthcallback
Last synced: 9 months ago
JSON representation
A local webserver for answering OAuth callbacks on localhost
- Host: GitHub
- URL: https://github.com/kstrauser/pythonoauthcallback
- Owner: kstrauser
- License: mit
- Created: 2013-08-22T02:42:38.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-08-23T05:21:02.000Z (almost 13 years ago)
- Last Synced: 2025-06-12T03:25:09.355Z (about 1 year ago)
- Language: Python
- Size: 125 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Python OAuth Callback
=====================
*A local webserver for answering OAuth callbacks*
OAuth is an increasingly popular system for authenticating client software to
Internet services, but it often requires coordination with a webserver hosted
by the client's developer. When the client software is an Open Source project
running on a user's computer and without any external supporting
infrastructure, this can present a difficult obstacle.
This package provides a standard framework for writing OAuth callback handlers
and running them on a local webserver temporarily set up for just that
purpose.
## Example
Authenticating to an App.net server:
>>> from oauthcallback.appdotnet import AppDotNetHandler
>>> token_info = AppDotNetHandler.fetch_access_token(
... client_id='XJtBFQwBesZHYE4TGcFwzvfq6D6a7NCa',
... scope='stream,public_messages')
>>> token_info['access_token']
'BigLongAlphanumericString'
You now have a token for accessing the user's account resources.
## Writing your own handler
Subclass `CallbackHandler` method's:
* `auth_url` returns the URL that the user's web browser will initially open
with.
* `do_Get` analyzes the callback request to parse out the access token or
other relevant data. Call `self.finish_with_result` to stop the web server
and return the results to the client program.
## License
Python OAuth Callback is available under the MIT License.