Skip to content

Instantly share code, notes, and snippets.

@ritik1009
Created September 11, 2022 10:45
Show Gist options
  • Save ritik1009/015844127b390067329cba21e0532c6b to your computer and use it in GitHub Desktop.
Save ritik1009/015844127b390067329cba21e0532c6b to your computer and use it in GitHub Desktop.
def get_short_lived_access_token(code = ''):
url = auth_url + 'oauth/access_token'
param = dict()
param['client_id'] = client_id
param['client_secret'] = client_secret
param['code'] = code
param['grant_type'] = 'authorization_code'
param['redirect_uri'] = redirect_uri
print("\n param",param)
response = requests.post(url=url,data=param)
response = response.json()
print("\n short lived access token response :-",response)
try:
access_token = response['access_token']
user_id = response['user_id']
return access_token
except:
print("\n error",response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment