Advertisement
OppaiCyber

ulerupbit

Jun 6th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.49 KB | None | 0 0
  1. # Python 3
  2.  
  3. import jwt    # PyJWT
  4. import uuid
  5. import hashlib
  6. from urllib.parse import urlencode
  7.  
  8. # query는 dict 타입입니다.
  9. m = hashlib.sha512()
  10. m.update(urlencode(query).encode())
  11. query_hash = m.hexdigest()
  12.  
  13. payload = {
  14.     'access_key': '발급받은 Access Key',
  15.     'nonce': str(uuid.uuid4()),
  16.     'query_hash': query_hash,
  17.     'query_hash_alg': 'SHA512',
  18. }
  19.    
  20. jwt_token = jwt.encode(payload, '발급받은 Secret Key',).decode('utf8')
  21. authorization_token = 'Bearer {}'.format(jwt_token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement