def decode_jwt(token, options=None):
""" Authenticate via JSON Web Token
Options: `secret`, `algorithms` """
options = options or {}
secret = options.get('secret', CONF and CONF.secret)
algorithms = options.get('algorithms', CONF and CONF.algorithms)
try:
data = jwt.decode(token, secret, algorithms)
except jwt.DecodeError:
raise Exception('Cannot decode token')
else:
logging.debug('* Decoded data = {}'.format(data))
return data
评论列表
文章目录