# Can't access my resource

**URL:** <https://devforum.zoom.us/t/cant-access-my-resource/29423>\
**Category:** API and Webhooks\
**Created:** [September 7, 2020, 4:52pm UTC](https://devforum.zoom.us/t/cant-access-my-resource/29423 "2020-09-07T16:52:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ofir.paz](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ofir.paz/32/14859_2.png) [@ofir.paz](https://devforum.zoom.us/u/ofir.paz)\
**Post date:** [September 7, 2020, 4:52pm UTC](https://devforum.zoom.us/t/cant-access-my-resource/29423/1 "2020-09-07T16:52:02Z")

</div>

**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

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [September 9, 2020, 7:12pm UTC](https://devforum.zoom.us/t/cant-access-my-resource/29423/2 "2020-09-09T19:12:56Z")

</div>

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](https://marketplace.zoom.us/docs/guides/chatbots/authorization#access-tokens).

To [call the Zoom APIs via the OAuth App Type](https://marketplace.zoom.us/docs/guides/authorization/oauth/oauth-with-zoom#request-access-token) you must use: `grant_type=code` to get an `access_token` .

OR

For server to server integration, you can use a [JWT App Type](https://marketplace.zoom.us/docs/guides/authorization/jwt/jwt-with-zoom) to call the Zoom APIs.

More details on [Zoom App Types here](https://marketplace.zoom.us/docs/guides/getting-started/app-types).

Let me know if this works for you!

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [October 10, 2020, 5:12am UTC](https://devforum.zoom.us/t/cant-access-my-resource/29423/3 "2020-10-10T05:12:58Z")

</div>

Closed on October 10, 2020, 5:12am UTC

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