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

// 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=---------’;
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(‘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

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?

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=---------

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

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