# Oauth Server 2 Server Call. Code 124 error invalid Token

**URL:** <https://devforum.zoom.us/t/oauth-server-2-server-call-code-124-error-invalid-token/81120>\
**Category:** API and Webhooks\
**Created:** [January 8, 2023, 12:20pm UTC](https://devforum.zoom.us/t/oauth-server-2-server-call-code-124-error-invalid-token/81120 "2023-01-08T12:20:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jason.bowsher](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jason.bowsher](https://devforum.zoom.us/u/jason.bowsher)\
**Post date:** [January 8, 2023, 12:20pm UTC](https://devforum.zoom.us/t/oauth-server-2-server-call-code-124-error-invalid-token/81120/1 "2023-01-08T12:20:02Z")

</div>

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](http://api.zoom.us/rcording/management) but I 1st try to test successful use of the token by calling [api.zoom.us/v2/users](http://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.”}’

---

<div class="post-metadata">

**Author:** ![freelancer.nak](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/freelancer.nak/32/40968_2.png) [@freelancer.nak](https://devforum.zoom.us/u/freelancer.nak)\
**Post date:** [January 8, 2023, 2:19pm UTC](https://devforum.zoom.us/t/oauth-server-2-server-call-code-124-error-invalid-token/81120/2 "2023-01-08T14:19:15Z")

</div>

@jason.bowsher Hope you will be fine.

Please build the authorization header as below 👇

> [@jason.bowsher](#):
>
> authorization\_header = ‘Authorization’: ‘Bearer ’

`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

---

<div class="post-metadata">

**Author:** ![jason.bowsher](https://avatars.discourse-cdn.com/v4/letter/j/ba8739/32.png) [@jason.bowsher](https://devforum.zoom.us/u/jason.bowsher)\
**Post date:** [January 11, 2023, 8:36am UTC](https://devforum.zoom.us/t/oauth-server-2-server-call-code-124-error-invalid-token/81120/3 "2023-01-11T08:36:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![freelancer.nak](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/freelancer.nak/32/40968_2.png) [@freelancer.nak](https://devforum.zoom.us/u/freelancer.nak)\
**Post date:** [January 11, 2023, 8:40am UTC](https://devforum.zoom.us/t/oauth-server-2-server-call-code-124-error-invalid-token/81120/4 "2023-01-11T08:40:13Z")

</div>

@jason.bowsher Then your token is expired. 👇

> [@jason.bowsher](#):
>
> ‘{“code”:124,“message”:“Invalid access token.”}’

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [January 15, 2024, 12:17am UTC](https://devforum.zoom.us/t/oauth-server-2-server-call-code-124-error-invalid-token/81120/5 "2024-01-15T00:17:05Z")

</div>

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