# Creating a meeting in Jquery

**URL:** <https://devforum.zoom.us/t/creating-a-meeting-in-jquery/5594>\
**Category:** Web\
**Created:** [August 20, 2019, 6:50am UTC](https://devforum.zoom.us/t/creating-a-meeting-in-jquery/5594 "2019-08-20T06:50:44Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [August 22, 2019, 8:56pm UTC](https://devforum.zoom.us/t/creating-a-meeting-in-jquery/5594/6 "2019-08-22T20:56:19Z")

</div>

Thanks @gokul,

First of all, calling Zoom APIs via the frontend (jQuery) is not supported. I suggest creating a [Node.js server](https://blog.risingstack.com/your-first-node-js-http-server/) to [make http requests](https://www.twilio.com/blog/2017/08/http-requests-in-node-js.html) to the Zoom API.

What is your full use case so I can provide advice on what type of [Zoom App](https://marketplace.zoom.us/docs/guides/getting-started/app-types) to create ([JWT](https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-jwt-app) vs. [OAuth](https://marketplace.zoom.us/docs/guides/getting-started/app-types/create-oauth-app))?

Nevertheless, I have fixed your code, and now you can get an access\_token, but when you call the create meeting endpoint you will get a `Invalid CORS request` error because we do not support `https://cors-anywhere.herokuapp.com/`

```auto
(function() {

  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=authorization_code&code={{ AUTH CODE FROM URL }}&redirect_uri=https://zoom.us';

  $.ajax({
    url: jsonURL,
    headers: {
      'content-type': 'application/json',
      'Authorization': 'Basic ' + btoa('CLIENT ID' + ':' + 'CLIENT SECRET')
    },
    type: 'POST',
    success: function(data, textStatus, xhr) {
      console.log('Received data is' + 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',
            'X-Requested-With': 'XMLHttpRequest',
            'Authorization': 'Bearer ' + data.access_token
          },
          type: 'POST',
          dataType: 'json',
          data: JSON.stringify({
            topic: 'New Meeting at 2',
            type: 1,
            start_time: '2019-08-22T14:00:00Z',
            duration: 45
          }),
          success: function(data, textStatus, xhr) {
            console.log(data);
          },
          error: function(xhr, textStatus, errorThrown) {
            console.log(xhr);

            console.log('Error in Operation');
          }
        });
      }
    },
    error: function(xhr, textStatus, errorThrown) {
      console.log('Error in Operation');
    }
  });

  });

})();

```

**NOTE:** This will only work **once** right after you “Install” your app via the install button on your Zoom App Dashboard and paste the code you get (in the redirect url after you click the “Authroize” button) to the `{{ AUTH CODE FROM URL }}` because each time you request a new access\_token with the same auth code it will invalidate the access\_token. The OAuth flow is meant to be hosted on a server side application and store the access\_token and refresh\_tokens in a database.

Also, I would not recommend using the `https://cors-anywhere.herokuapp.com/` trick to call our APIs on the frontend. Our APIs are meant to be called from server side applications, to ensure security. For example, anyone will be able to see your client id and client secret if you deploy this code.

Let me know if you have any other questions.

Thanks,  
Tommy

---

_[View the full topic](https://devforum.zoom.us/t/creating-a-meeting-in-jquery/5594)._
