# {"code":124,"message":"Invalid access token."}

**URL:** <https://devforum.zoom.us/t/code-124-message-invalid-access-token/86466>\
**Category:** App Marketplace\
**Created:** [April 11, 2023, 12:27pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token/86466 "2023-04-11T12:27:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![00786samadali.bangal](https://avatars.discourse-cdn.com/v4/letter/0/7cd45c/32.png) [@00786samadali.bangal](https://devforum.zoom.us/u/00786samadali.bangal)\
**Post date:** [April 11, 2023, 12:27pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token/86466/1 "2023-04-11T12:27:05Z")

</div>

// Set your Zoom app’s Client ID and Client Secret  
String clientId = ‘\_-------------’;  
String clientSecret = ‘----------’;

// Encode the Client ID and Client Secret in base64  
String base64Credentials = EncodingUtil.base64Encode(Blob.valueOf(clientId + ‘:’ + clientSecret));

// Set the POST request endpoint and parameters  
String endpoint = ‘[https://zoom.us/oauth/token?grant\_type=account\_credentials&account\_id=---------](https://zoom.us/oauth/token?grant_type=account_credentials&account_id=---------)’;  
String grantType = ‘client\_credentials’;

// Create the HTTP request  
HttpRequest request = new HttpRequest();  
request.setEndpoint(endpoint);  
request.setMethod(‘POST’);  
request.setHeader(‘Content-Type’, ‘application/x-www-form-urlencoded’);  
request.setHeader(‘Authorization’, 'Basic ’ + base64Credentials);

// Set the request body with the grant\_type parameter  
[//request.setBody](https://request.setBody)(‘grant\_type=’ + grantType);

// Create the HTTP connection and send the request  
Http http = new Http();  
HttpResponse response = http.send(request);

// Parse the response  
if (response.getStatusCode() == 200) {  
// Successful response  
String responseBody = response.getBody();  
System.debug('Response Body: ’ + responseBody);  
// Extract the access token from the response

} else {  
// Error handling for failed response  
System.debug('HTTP Error: ’ + response.getStatusCode() + ’ ’ + response.getStatus());  
System.debug('Error Message: ’ + response.getBody());  
}

I am getting the access token. But when I tried to access the resource getting invalid access token. Can anyone help me out in this

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [April 11, 2023, 8:16pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token/86466/2 "2023-04-11T20:16:58Z")

</div>

Hi @00786samadali.bangal  
Thanks for reaching out to the Zoom Developer forum and welcome to our community, I am happy to help here!  
Could you please share with me what endpoint are you trying to call with the access token that you are generating with your Server to Server Oauth app please?

---

<div class="post-metadata">

**Author:** ![00786samadali.bangal](https://avatars.discourse-cdn.com/v4/letter/0/7cd45c/32.png) [@00786samadali.bangal](https://devforum.zoom.us/u/00786samadali.bangal)\
**Post date:** [April 12, 2023, 6:24am UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token/86466/3 "2023-04-12T06:24:09Z")

</div>

> [@00786samadali.bangal](#):
>
> ‘[https://zoom.us/oauth/token?grant\_type=account\_credentials&account\_id=---------](https://zoom.us/oauth/token?grant_type=account_credentials&account_id=---------)

The end point which i used in postman to get the access token.  
end point: ‘[https://zoom.us/oauth/token?grant\_type=account\_credentials&account\_id=---------](https://zoom.us/oauth/token?grant_type=account_credentials&account_id=---------)

---

<div class="post-metadata">

**Author:** ![elisa.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/elisa.zoom/32/47836_2.png) [@elisa.zoom](https://devforum.zoom.us/u/elisa.zoom)\
**Post date:** [April 12, 2023, 12:09pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token/86466/4 "2023-04-12T12:09:46Z")

</div>

Does your access\_token has the appropriate scopes to call the endpoint that you are trying? @00786samadali.bangal

---

<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:** [May 11, 2023, 10:27pm UTC](https://devforum.zoom.us/t/code-124-message-invalid-access-token/86466/5 "2023-05-11T22:27:31Z")

</div>

This topic was automatically closed after 30 days. New replies are no longer allowed.
