Requesting access token responds with a status code of 403

I am following the oauth 2.0 documentation but I am running into a problem where I am unable to make the post request to https://zoom.us/oauth/token. Whenever I access my route, the error message states “Request failed with status code 403.” My code is here:

 router.get('/zoom', auth, async (req, res) => {
  if (req.query.code) {
    const url = `https://zoom.us/oauth/token?grant_type=authorization_code&code=${req.query.code}&redirect_uri=${CLIENT_HOME_PAGE_URL}`;
    const headers = {
      'Content-Type': 'application/json',
      Authorization:
        'Basic clientid:clientsecret'
    };
    try {
      const res = await axios.post(url, null, { headers: headers });
      console.log(res);
    } catch (err) {
      console.error(err.message);
      return res.status(500).send('Sever Error');
    }
  }
  res.redirect(
    `https://zoom.us/oauth/authorize?response_type=code&client_id=${ZOOM_CLIENT_ID}&redirect_uri=${ZOOM_REDIRECT_URI}`
  );
});

with ZOOM_REDIRECT_URI referring to the same route and the clientid:clientsecret in base64string. Where is the error located?

Hey @jatongsu2003,

Your request looks correct. Is there an error message returned from Zoom?

Thanks,
Tommy

Yeah I decided to use request instead of axios and it works now.

1 Like

Happy to hear you got it working! :slight_smile:

Thanks,
Tommy