https://github.com/siongui/webpy-oauth
Basic OAuth 2.0 Support (Google and Facebook Login) for Web.py
https://github.com/siongui/webpy-oauth
facebook facebook-login python secret webpy
Last synced: about 1 year ago
JSON representation
Basic OAuth 2.0 Support (Google and Facebook Login) for Web.py
- Host: GitHub
- URL: https://github.com/siongui/webpy-oauth
- Owner: siongui
- License: unlicense
- Created: 2013-10-14T21:13:44.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2021-11-16T02:10:45.000Z (over 4 years ago)
- Last Synced: 2025-05-08T02:47:26.945Z (about 1 year ago)
- Topics: facebook, facebook-login, python, secret, webpy
- Language: Python
- Size: 7.81 KB
- Stars: 7
- Watchers: 3
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Basic OAuth 2.0 Support for [Web.py](http://webpy.org/)
Implement basic OAuth 2.0 support for web.py. Inspired by [simpleauth](https://github.com/crhym3/simpleauth).
## Supported providers:
- Google (OAuth 2.0)
- Doc:
- [Using OAuth 2.0 for Web Server Applications](https://developers.google.com/accounts/docs/OAuth2WebServer)
- [Using OAuth 2.0 for Login](https://developers.google.com/accounts/docs/OAuth2Login)
- Create App & Get client ID/Secret:
- [Google Cloud Console](https://cloud.google.com/console)
- Scopes:
- `https://www.googleapis.com/auth/userinfo.profile`: Userinfo - Profile
- `https://www.googleapis.com/auth/userinfo.email`: Userinfo - Email
- Reference: [List of Google OAuth Scopes](http://www.subinsb.com/2013/04/list-google-oauth-scopes.html)
- Facebook (OAuth 2.0)
- Doc:
- [The Login Flow for Web (without JavaScript SDK)](https://developers.facebook.com/docs/facebook-login/login-flow-for-web-no-jssdk/)
- Create App & Get client ID/Secret:
- [Facebook Developers](https://developers.facebook.com/apps)
- Scopes:
- `email`: Provides access to the primary email address of the user in the email property.
- `user_about_me`: Provides access to the "About Me" section of the profile in the about property
- Reference: [Permissions](https://developers.facebook.com/docs/facebook-login/permissions/)
## Dependency
- Web.py: see [Web.py Install Guide](http://webpy.org/install) to install web.py.
## Usage & Example
1. Create app & get client id/secret from providers. (Google: [Google Cloud Console](https://cloud.google.com/console), Facebook: [Facebook Developers](https://developers.facebook.com/apps))
2. Put `auth.py` in your project root dir, and also add your project root dir to sys path. `auth.py` handles OAuth 2.0 process for you, and you do not need to modify this script.
3. In you main python script, create a request handler by subclassing `auth.handler`. Set url routing and client id/secret. Please refer to `login.py` for a complete example.
4. You can run the example (remember to modify app id/secret and `callback_uri` function in the exmaple) by the following bash command:
```bash
$ python login.py
```
## References
- [SimpleAuth](https://github.com/crhym3/simpleauth)
- [Facebook login on top of webpy](http://matteolandi.blogspot.tw/2012/09/facebook-login-on-top-of-webpy.html)
- [Facebook OAuth Example](http://facebook-python-library.docs-library.appspot.com/facebook-python/examples/oauth.html)
## Other
This project is released in public domain, see [UNLICENSE](http://unlicense.org/)