Description/Error
We want to create a meeting using Jquery and Js. But we are getting error of " 1. {code: 200, message: “Invalid api key or secret.”}.
We were using the following code for creating a meeting
(function(){
ZoomMtg.preLoadWasm();
ZoomMtg.prepareJssdk();
var API_KEY = 'F6X0MxxxxxxxxxTFg';
/**
* NEVER PUT YOUR ACTUAL API SECRET IN CLIENT SIDE CODE, THIS IS JUST FOR QUICK PROTOTYPING
* The below generateSignature should be done server side as not to expose your api secret in public
* You can find an eaxmple in here: https://marketplace.zoom.us/docs/sdk/native-sdks/Web-Client-SDK/tutorial/generate-signature
*/
var API_SECRET = '1uDbxxxxxxxxxxxxxxxxxxxCCUyl8L';
document.getElementById('join_meeting').addEventListener('click', function(e){
e.preventDefault();
const proxyurl = "https://cors-anywhere.herokuapp.com/";
var jsonURL= proxyurl+'https://zoom.us/oauth/token?grant_type=client_credentials&client_id='+API_KEY+'&client_secret='+API_SECRET;
$.ajax({
url: jsonURL,
headers: {'content-type' : 'application/json'},
type: 'POST',
dataType: 'json',
success: function (data, textStatus, xhr) {
console.log("datais"+data.access_token);
if(data.access_token){
const url = proxyurl + 'https://api.zoom.us/v2/users/me/meetings';
$.ajax({
url: url,
headers: {'content-type' : 'application/json', 'Authorization': 'Bearer ' + data.access_token},
type: 'POST',
dataType: 'json',
data:JSON.stringify({"topic": "New Meeting at 2", "type":"1", "start_time": "2019-08-20T14:00:00Z", "duration": "45"}),
success: function (data, textStatus, xhr) {
console.log(data);
},
error: function (xhr, textStatus, errorThrown) {
console.log('Error in Operation');
}
});
}
},
error: function (xhr, textStatus, errorThrown) {
console.log('Error in Operation');
}
});
});
})();