Created
March 30, 2018 04:50
-
-
Save salrashid123/0baa3a876fbd6acbcfe8ac04c0c22b0b to your computer and use it in GitHub Desktop.
svc_exchange.py
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
url = 'https://accounts.google.com/o/oauth2/token' | |
data = {'grant_type' : 'assertion', | |
'assertion_type' : 'http://oauth.net/grant_type/jwt/1.0/bearer', | |
'assertion' : signed_jwt } | |
headers = {"Content-type": "application/x-www-form-urlencoded"} | |
data = urllib.urlencode(data) | |
req = urllib2.Request(url, data, headers) | |
resp = urllib2.urlopen(req).read() | |
parsed = json.loads(resp) | |
access_token = parsed.get('access_token') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment