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