https://github.com/knoxilla/flessions
Flask, Flask-Sessions, and the Box SDK for Python.
https://github.com/knoxilla/flessions
box-sdk flask oauth redis sessions
Last synced: 3 months ago
JSON representation
Flask, Flask-Sessions, and the Box SDK for Python.
- Host: GitHub
- URL: https://github.com/knoxilla/flessions
- Owner: knoxilla
- Created: 2017-05-12T18:53:08.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-07-07T13:20:36.000Z (about 3 years ago)
- Last Synced: 2025-05-18T12:07:48.765Z (about 1 year ago)
- Topics: box-sdk, flask, oauth, redis, sessions
- Language: Python
- Homepage:
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Box SDK and Oauth2 in Flask
Just a quick demo of authorizing the Box SDK via OauthW in a Flask app.
Fake user logins are associated with sessions, and Flask-Sessions is used to store session keys/values in local Redis at 127.0.0.1:6379.
To run, clone this repo, `cd` into it, and:
% virtualenv env
% . env/bin/activate
% pip install -r requirements.txt
% cp boxapp.cfg-sample boxapp.cfg
%
% python flessions.py
The `/auth/` route kicks off the Oauth2 journey, and the `/callback` route completes the circle.
Once the access_token and refresh_token are stored in the session, we can pull them out to construct an authenticated Box client on-demand.
The `/whoami` and `/mystuff` routes exercise the Box API after the application has been authorized, and the tokens stored.
Lots to do here to make this sane regarding users, sessions, expiry, persistence, etc.