Python utility functions and Django/Flask middlewares for validating JWT tokens from Google's Identity-Aware Proxy
Validating JWT tokens from the Google Identity-Aware Proxy as middleware.
pip install -e firstname.lastname@example.org:newsdev/nyt-pyiap.git
Add to settings
Update your settings.py file to add the Django middleware.
MIDDLEWARE_CLASSES = [ ... 'pyiap.django.VerifyJWTMiddleware', ... ]
The request object in views.py will have two new attributes added: - request.jwt_user_id: The Google internal ID of the user who has been verified by IAP. - request.jwt_user_email: The email address and email type of the user who has been verified by IAP.
Update your Flask app.py to wrap your instantiated Flask() application’s wsgi_app with the VerifyJWTMiddleware.
app = Flask(__name__) app.wsgi_app = VerifyJWTMiddleware(app.wsgi_app)
The request.environ object in app.py will have two new attributes added: - request.environ['jwt_user_id']: The Google internal ID of the user who has been verified by IAP. - request.environ['jwt_user_email']: The email address and email type of the user who has been verified by IAP.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size nyt-pyiap-0.1.9.tar.gz (4.7 kB)||File type Source||Python version None||Upload date||Hashes View|