Oauth Server 2 Server Call. Code 124 error invalid Token

I send a token request with the following python and sucessfull get a access token

def get_access_token(url, client_id, client_secret, account_id):
response = requests.post(
url,
data={“grant_type”: “client_credentials”, “account_id”:account_id},
auth=(client_id, client_secret),
)
#return response.json()[“access_token”]
return response

I then want to call zoom API with a token. Ideally to get a list of all recordings that are shown at api.zoom.us/rcording/management but I 1st try to test successful use of the token by calling api.zoom.us/v2/users

authorization_header = ‘Authorization’: ‘Bearer ’

def get_user_list(url, authorization_header, status=‘active’, page_size=30):
post_data = {
‘status’:status,
‘page_size’:page_size
}
response = requests.get(
url=url,
headers=authorization_header,
params=post_data,
auth=(client_id, client_secret)
)
return response

However I get a 124 response saying Invalid Token Access. The app has scope: ‘recording:write:admin user:read:admin recording:read:admin’
reason:
‘Unauthorized’
request:
<PreparedRequest [GET]>
status_code:
401
text:
‘{“code”:124,“message”:“Invalid access token.”}’

@jason.bowsher Hope you will be fine.

Please build the authorization header as below :point_down:

authorization_header = ‘Authorization’: ‘Bearer {access_token} ’. Must be a space after the Bearer keyword.

I hope that works if still an issue then reply here. Thanks

There was a space. but thanks for the check. It is now past this point. Looks like it may have been due to running postman at the same time as the code and competing tokens issues. Stopped postman and it gets past this point in the code

@jason.bowsher Then your token is expired. :point_down:

This topic was automatically closed 368 days after the last reply. New replies are no longer allowed.