Created
November 10, 2016 04:41
-
-
Save abhaybhargav/9417c6f11cda296598ddbebdfc5ab1a5 to your computer and use it in GitHub Desktop.
Validating the JWT
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
def verify_jwt(token): | |
try: | |
decoded = jwt.decode(token, app.config['SECRET_KEY_HMAC'], verify=True, issuer = 'we45', leeway=10, algorithms=['HS256']) | |
print("JWT Token from API: {0}".format(decoded)) | |
return True | |
except DecodeError: | |
print("Error in decoding token") | |
return False | |
except MissingRequiredClaimError as e: | |
print('Claim required is missing: {0}'.format(e)) | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment