Created
September 11, 2022 10:45
-
-
Save ritik1009/015844127b390067329cba21e0532c6b to your computer and use it in GitHub Desktop.
This file contains 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
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