Hi,
I’m trying to use django allauth to connect my app to zoom api. I have been able to authenticate my user account but am having issues with performing actions without
a proper access token. In order to get a valid access token and refresh token, I am trying to retrieve both of them, but I think I am not submitting the correct refresh token. This is how I am attempting to find the initial refresh token:
refresh_token = SocialToken.objects.get(account__user=request.user, account__provider=‘zoom’)
#These are the different attributes listed for my SocialToken object
print(refresh_token.id)
print(refresh_token.app)
print(refresh_token.account)
print(refresh_token.token)
print(refresh_token.token_secret)
print(refresh_token.expires_at)
token_url = f’https://zoom.us/oauth/token’
headers = {
‘Authorization’: ‘Basic ’ + base64.b64encode(f’{client_id}:{client_secret}'.encode(‘utf-8’)).decode(‘utf-8’),
‘Content-Type’: ‘application/x-www-form-urlencoded’,
}
data = {
‘grant_type’: ‘refresh_token’,
‘refresh_token’ : refresh_token.token,
}
data_encoded = “&”.join([f"{key}={value}" for key, value in data.items()])
response = requests.post(token_url, headers=headers, data=data_encoded)
I seem to be getting two errors, which I assume are related:
400 Client Error: Bad Request for url: https://zoom.us/oauth/token
Error during token refresh: 400, {“reason”:“Invalid Token!”,“error”:“invalid_grant”}
I have added the user:read, recording:read, and recording:write scopes. Any help would be greatly appreciated!