Skip to content

Instantly share code, notes, and snippets.

@beleidy
Created February 9, 2019 13:23
Show Gist options
  • Save beleidy/183098d6bba67aa4408bb98da45f0852 to your computer and use it in GitHub Desktop.
Save beleidy/183098d6bba67aa4408bb98da45f0852 to your computer and use it in GitHub Desktop.
Get ID JWT from Google OAuth2 credentials
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