Created
February 9, 2019 13:23
-
-
Save beleidy/183098d6bba67aa4408bb98da45f0852 to your computer and use it in GitHub Desktop.
Get ID JWT from Google OAuth2 credentials
This file contains 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
flow = google_auth_oauthlib.flow.Flow.from_client_config( | |
CLIENT_SECRET, scopes=SCOPES) | |
flow.redirect_uri = url_for('oauth2_callback', _external=True) | |
authorization_response = request.url | |
# Replace with https to avoid InsecureTrasnportError | |
authorization_response = authorization_response.replace('http', 'https') | |
flow.fetch_token(authorization_response=authorization_response) | |
credentials = flow.credentials | |
jwt_id_token = credentials.id_token |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment