CORS preflight error

Hi,

     I am trying to send http get request for getusers method of zoomapi through angular js, I have grabbed bearer token by passing api key and secret key through jwt .io. In postman same method working fine…But in my code its throwing cors prefight error.  My code of http request in java script(angular js) is

return $http({
      method: ‘get’,
     url: ‘https://api.zoom.us/v2/users’,
      params: {
           status: ‘active’,
           page_size: 30,
           page_number: 1
      },
     headers: {
         ‘content-type’: ‘application/json’,
         ‘accept’: ‘application/json, application/xml’,
          ‘Access-Control-Allow-Origin’: 'https://www.zoom.us’, 
         ‘Authorization’: 'Bearer ‘+ ’ /*token which i have got from jwt.io*/’
      }
});

 In above code have tried by commenting line of Access-Control-Allow-Origin’ or by passing the ‘*’ for that

but its not working CORS preflight error is coming.The error is

OPTIONS https://api.zoom.us/v2/users?status=active&page_size=30&page_number=1&[object%20FormData] 403 (Forbidden)

Failed to load https://api.zoom.us/v2/users?status=active&page_size=30&page_number=1&[object%20FormData]: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘null’ is therefore not allowed access. The response had HTTP status code 403.

So is there any way to solve this error…or i am missing something.Because it is working in postman fine.

One more thing i have got some examples of version 1…but i didn’t get any example of version 2…so from where i can get that?

                                                         and

            I have seen one example of version 1 from this link https://support.zoom.us/hc/en-us/articles/204873935-Getting-Started-With-JavaScript-API?mobile_site=true…   

         In this example zoom. init and zoom.login methods are used by referring zoomus.js(version1) to do further operations.

         But we are using the first one approach by creating bearer token through jwt.io. and referring that for further request of zoomapi such as create meeting etc. So which one is correct approach ?

 

thanks

 

I am getting a similar error. Can anyone point us in the right direction?

Hi Dhruv & Shannon

It does not support cross-origin resource sharing or access via a client-side web application. Refer to https://zoom.github.io/api/#introduction 

So we suggest that you should call REST API through creating HTTP request in your system backend and then respond data to pages

1 Like

is there any hack to call zoom api from jquery now ?

Hey @ofd.aws96,

To call the Zoom API you need to use the server side, not the client side.

Thanks,
Tommy