Skip to content

Instantly share code, notes, and snippets.

@inklesspen
Created April 16, 2019 18:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save inklesspen/41042ee0864aa27a2f18c91c2714371c to your computer and use it in GitHub Desktop.
Save inklesspen/41042ee0864aa27a2f18c91c2714371c to your computer and use it in GitHub Desktop.
import base64
import json
def extract_jwt_claims(req):
header = req.headers.get('X-Endpoint-API-UserInfo')
if header is None:
return None
val = json.loads(base64.urlsafe_b64decode(header))
claims_json = val['claims']
claims = json.loads(claims_json)
return claims
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment