Created
March 29, 2018 22:46
-
-
Save brianv0/8c735216e9e13b98932db3da3008fbc9 to your computer and use it in GitHub Desktop.
Dump Token
This file contains hidden or 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
import requests | |
import json | |
import jwt | |
url = "https://example.com/protected/stuff/blah" | |
scope = ["write:/stuff", "read:mysql://lsst-qserv:4040/"] | |
subject = "bvan" | |
demo_json = { | |
"payload": { | |
'scp': scope, | |
'aud': "", | |
'sub': subject | |
}, | |
"header": { | |
'alg': 'RS256', | |
'typ': 'JWT' | |
} | |
} | |
data = json.dumps({ | |
'payload': json.dumps(demo_json['payload']), | |
'header': json.dumps(demo_json['header']) | |
}) | |
head = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36','Content-Type': 'application/json'} | |
r = requests.post("https://demo.scitokens.org/issue", data = data, headers = head) | |
unverified_payload = jwt.decode(r.text, verify=False, algorithms=['RS256']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment