HTTPError during token refresh: 400, {"reason":"Invalid Token!","error":"invalid_grant"}


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

token_url = f’
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 =, headers=headers, data=data_encoded)

I seem to be getting two errors, which I assume are related:
400 Client Error: Bad Request for url:
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!

You can only refresh an access token once you’ve retrieved a valid OAuth access token.

When you retrieve a an access token, a refresh token will also be shared in the response.

This part is accurate, but you are missing the appropriate request body parameters. You can see them here in our docs: OAuth for user authorized apps

You may also use our public workspace for assistance: Postman

Review the Overview for guidance on using the workspace.