Can't access my resource

Description
I’m creating an app that should let me create webinars on my account.
my app is written in node js and I’m trying to use my resource on zoom through the API. when I’m trying to create the bearer token using:

var https = require('follow-redirects').https;

var fs = require('fs');

var options = {

  'method': 'POST',

  'hostname': 'zoom.us',

  'path': '/oauth/token?grant_type=client_credentials',

  'headers': {

    'Content-Type': 'application/json',

    'Authorization': 'Basic Shhh',

  },

  'maxRedirects': 20

};

var req = https.request(options, function (res) {

  var chunks = [];

  res.on("data", function (chunk) {

    chunks.push(chunk);

  });

  res.on("end", function (chunk) {

    var body = Buffer.concat(chunks);

    console.log(body.toString());

  });

  res.on("error", function (error) {

    console.error(error);

  });

});

req.end();

I’m getting the bearer token correctly.
But when I try to use this token to access my resources using:

var https = require('follow-redirects').https;

var fs = require('fs');

var options = {

  'method': 'POST',

  'hostname': 'api.zoom.us',

  'path': '/v2/accounts',

  'headers': {

    'Authorization': 'Bearer Shhhh',

    'Content-Type': 'application/json',

  },

  'maxRedirects': 20

};

var req = https.request(options, function (res) {

  var chunks = [];

  res.on("data", function (chunk) {

    chunks.push(chunk);

  });

  res.on("end", function (chunk) {

    var body = Buffer.concat(chunks);

    console.log(body.toString());

  });

  res.on("error", function (error) {

    console.error(error);

  });

});

var postData = JSON.stringify({"first_name":"xxx","last_name":"xxx","email":"yyy@zz.ww","password":"QQQQQ"});

req.write(postData);

req.end();

I’m getting the error response:

Error

status code: 400
{

    "code": 200,

    "message": "Invalid API key or secret."

} 

Which App Type (OAuth)?

  • OAuth

Which Endpoint/s?

  • /oauth/token
  • all other endpoint

How To Reproduce (If applicable)
described above

Screenshots (If applicable)
none

Additional context
Note: the app works only on the server-side and without client-side.
therefore: there is no user to redirect or website URL etc

Hey @ofir.paz,

I appreciate the context and code sample—happy to help out.

To that end, I noticed you are trying to use: grant_type=client_credentials to get an access_token . The grant_type=client_credentials is only for getting Chatbot tokens .

To call the Zoom APIs via the OAuth App Type you must use: grant_type=code to get an access_token .

OR

For server to server integration, you can use a JWT App Type to call the Zoom APIs.

More details on Zoom App Types here .

Let me know if this works for you!

Thanks,
Will

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