# Zoom API access\_token fetch from Zoom API documentation code are different than from Zoom marketplace.zoom.us Get Access Token Button

**URL:** <https://devforum.zoom.us/t/zoom-api-access-token-fetch-from-zoom-api-documentation-code-are-different-than-from-zoom-marketplace-zoom-us-get-access-token-button/35184>\
**Category:** API and Webhooks\
**Created:** [November 5, 2020, 10:24am UTC](https://devforum.zoom.us/t/zoom-api-access-token-fetch-from-zoom-api-documentation-code-are-different-than-from-zoom-marketplace-zoom-us-get-access-token-button/35184 "2020-11-05T10:24:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rex-workwithme](https://avatars.discourse-cdn.com/v4/letter/r/e0b2c6/32.png) [@rex-workwithme](https://devforum.zoom.us/u/rex-workwithme)\
**Post date:** [November 5, 2020, 10:24am UTC](https://devforum.zoom.us/t/zoom-api-access-token-fetch-from-zoom-api-documentation-code-are-different-than-from-zoom-marketplace-zoom-us-get-access-token-button/35184/1 "2020-11-05T10:24:31Z")

</div>

**Description**  
Zoom API access\_token fetch from Zoom API documentation code are different than from Zoom marketplace Get Access Token Button

**Error**  
When Using the access\_token from this code I can’t create a meeting.

**Which App Type (OAuth / Chatbot / JWT / Webhook)?**  
OAuth

**Which Endpoint/s?**  
access\_token

**Additional context**  
My code chunk to get access token is:

var request = require(“request”);

var options = {  
method: ‘POST’,  
url: ‘[https://zoom.us/oauth/token?grant\_type=client\_credentials](https://zoom.us/oauth/token?grant_type=client_credentials)’,  
headers: {  
/\*\*The credential below is a sample base64 encoded credential. Replace it with “Authorization: 'Basic ’ + Buffer.from(your\_app\_client\_id + ‘:’ + your\_app\_client\_secret).toString(‘base64’)”  
\*\*/  
Authorization: 'Basic ’  
}  
};

request(options, function (error, response, body) {  
if (error) throw new Error(error);

var obj = JSON.parse(body);  
var token = obj.access\_token;  
console.log(JSON.parse(body));  
});

It gives the output:

{  
access\_token: ‘token’,  
token\_type: ‘bearer’,  
expires\_in: 3600,  
scope: ‘account:master account:read:admin account:write:admin meeting:master meeting:read:admin meeting:write:admin recording:master recording:read:admin recording:write:admin user:master user:read:admin user:write:admin webinar:master webinar:read:admin webinar:write:admin’  
}

And for creating a meeting I simply copy the access token and pass into the next code. The code is below:

var request = require(“request”);  
var options = {  
method: “POST”,  
url: “[https://api.zoom.us/v2/users/me/meetings](https://api.zoom.us/v2/users/me/meetings)”,  
headers: {  
“content-type”: “application/json”,  
authorization:  
"Bearer ", //it changes every 30 mins  
},  
body: {  
agenda: “”,  
assistant\_id: “”,  
created\_at: “2020-11-06T05:42:54.522Z”,  
timezone: “Asia/Kolkata”,  
encrypted\_password: “”,  
h323\_password: “”,  
host\_email: “rex@workwithme.in”,  
host\_id: “blEqWHKgT2OoQkGQPGBs1Q”, //input your host id  
id: “”,  
join\_url: “”,  
password: “7msSQ”,  
pstn\_password: “”,  
settings: {  
alternative\_hosts: “”,  
approval\_type: 2,  
audio: “both”,  
auto\_recording: “none”,  
close\_registration: false,  
cn\_meeting: false,  
enforce\_login: false,  
enforce\_login\_domains: “”,  
host\_video: true,  
in\_meeting: false,  
join\_before\_host: false,  
meeting\_authentication: false,  
mute\_upon\_entry: false,  
participant\_video: true,  
registrants\_confirmation\_email: true,  
registrants\_email\_notification: true,  
request\_permission\_to\_unmute\_participants: false,  
use\_pmi: false,  
waiting\_room: true,  
watermark: false,  
},  
start\_url: “”,  
status: “started”,  
timezone: “Asia/Kolkata”,  
topic: “Pintu Das’ Zoom Meeting”,  
type: 1,  
uuid: “”,  
},  
json: true,  
};

request(options, function (error, resp, body) {  
if (error) throw new Error(error);

console.log(body);  
console.log(resp.body.join\_url);  
});

It gives me an error:

{ code: 200, message: ‘Invalid api key or secret.’ }  
undefined

---

<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:** [November 6, 2020, 5:59pm UTC](https://devforum.zoom.us/t/zoom-api-access-token-fetch-from-zoom-api-documentation-code-are-different-than-from-zoom-marketplace-zoom-us-get-access-token-button/35184/2 "2020-11-06T17:59:50Z")

</div>

Hi @rex-workwithme,

Thanks for reaching out, and happy to help take a closer look. Please note that I redacted some of the tokens you provided, as these contain sensitive information.

To clarify, are you saying that the API response when calling `https://zoom.us/oauth/token` returns an invalid access\_token? If this is the case, can you share the full URL (including the `code` value you’re passing) with us at [developersupport@zoom.us](mailto:developersupport@zoom.us)? Happy to take a closer look. (Please don’t share these details here.)

Note that in your URL to hit the oauth endpoint, the `grant_type` value should be the value of the `code` you receive from the URL after a user authorizes your app. At the moment, it seems like you _may_ be passing a different value.

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:** [December 7, 2020, 3:59am UTC](https://devforum.zoom.us/t/zoom-api-access-token-fetch-from-zoom-api-documentation-code-are-different-than-from-zoom-marketplace-zoom-us-get-access-token-button/35184/3 "2020-12-07T03:59:55Z")

</div>

Closed on December 7, 2020, 3:59am UTC

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