CORs error while Zoom API call from ReactJS

Description
I am using ReactJS for front end and Django for back end. I have to integrate Zoom WEB SDK and also have to use Zoom APIs(for creating meetings, and other purposes which aren’t available via SDK).

On making the API call from ReactJS I am getting the CORs error in my browser console.

Error
Access to XMLHttpRequest at ‘https://api.zoom.us/v2/users/{USER_ID}/meetings’ from origin ‘http://localhost:8000’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: It does not have HTTP ok status.

App Type is JWT.
The JWT token is being generated from the back end i.e Django and I am passing it in Authorization header.

API endpoint: https://api.zoom.us/v2/users/{USER_ID}/meetings

How To Reproduce (If applicable)
Steps to reproduce the behavior:

  1. Back end code generates JWT token and passes to ReactJS
  2. On button click to create meeting below API POST call is made.
const config = {
      headers: {
        Authorization: `Bearer ${jwt_token}`,
        'Content-Type': 'application/json'
      },
    };
const data = {
      'topic': 'Sample Discussion',
      'type': '1',
      'duration': '60',
      'password': 'IamThePassword321',
      'agenda': 'To discuss various plans meeting',
      'settings': {
        'host_video': 'true',
        'participant_video': 'true',
        'join_before_host': 'true',
        'mute_upon_entry': 'true',
        'watermark': 'true',
        'use_pmi': 'false',
        'approval_type': '0',
        'audio': 'both',
        'auto_recording': 'cloud',
      }
    };
const url = 'https://api.zoom.us/v2/users/{USER_ID}/meetings';
return axios({
      config,
      url: url,
      method: 'post',
      data: data
    });

Screenshots

It seems that calling Zoom APIs from front end will always throw this issue, so I moved the API call to my back end server from NodeJS where the API calls are being done successfully.

Also make sure the password for the meeting is set to string that has less than 10 characters or else will end up fail in API call (as in my case I have set password to “IamThePassword321” and I was getting error due to this from Node server.

1 Like

Hey @vijay.singh,

Thanks for sharing your solution! :slight_smile:

Yes, the Zoom API must be called from the server side / backend. If called from the client side / frontend, you will get CORs errors.

-Tommy

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.