jwt_test.py 427 B

123456789101112131415161718
  1. from itsdangerous import TimedJSONWebSignatureSerializer as Serializer
  2. def verify_auth_token(token):
  3. s = Serializer('hard to guess string')
  4. try:
  5. data = s.loads(token)
  6. except:
  7. return None
  8. return data
  9. def test():
  10. print(verify_auth_token(
  11. 'eyJhbGciOiJIUzI1NiIsImlhdCI6MTUzNzg0Njc4MywiZXhwIjoxNTM5MDU2MzgzfQ.eyJpZCI6MzI0NTEzNH0.RqRoad8H5oAGY6L3qMLcxCUYE5Fl7-MXtpSyfSU4aqU'))
  12. test()