# Getting a 400 error when attempting to get an access token from zoom.us/oauth/token

**URL:** <https://devforum.zoom.us/t/getting-a-400-error-when-attempting-to-get-an-access-token-from-zoom-us-oauth-token/58289>\
**Category:** API and Webhooks\
**Created:** [October 1, 2021, 7:22pm UTC](https://devforum.zoom.us/t/getting-a-400-error-when-attempting-to-get-an-access-token-from-zoom-us-oauth-token/58289 "2021-10-01T19:22:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![transcodedinc](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/transcodedinc/32/20522_2.png) [@transcodedinc](https://devforum.zoom.us/u/transcodedinc)\
**Post date:** [October 1, 2021, 7:22pm UTC](https://devforum.zoom.us/t/getting-a-400-error-when-attempting-to-get-an-access-token-from-zoom-us-oauth-token/58289/1 "2021-10-01T19:22:48Z")

</div>

**Description**  
Hello. After authentication I am getting a code that’s attached to the redirect URL, then I am making a post request to the server with this code in the request body where I am trying to get an access token

**Error**  
{“error”:{“message”:“Request failed with status code 400”,“name”:“Error”,“stack”:“Error: Request failed with status code 400\n at createError (/workspace/node\_modules/axios/lib/core/createError.js:16:15)\n at settle (/workspace/node\_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/workspace/node\_modules/axios/lib/adapters/http.js:236:11)\n at IncomingMessage.emit (events.js:412:35)\n at endReadableNT (internal/streams/readable.js:1317:12)\n at processTicksAndRejections (internal/process/task\_queues.js:82:21)”,“config”:{“url”:“[https://zoom.us/oauth/token?code=xxxxxxxxxxxxxxxxxxxxxxx&grant\_type=authorization\_code&redirect\_uri=https://app.butternbinge.com/trending",“method”:“post”,“data”:null,“headers”:{“Accept”:"application/json](https://zoom.us/oauth/token?code=xxxxxxxxxxxxxxxxxxxxxxx&grant_type=authorization_code&redirect_uri=https://app.butternbinge.com/trending%22,%22method%22:%22post%22,%22data%22:null,%22headers%22:%7B%22Accept%22:%22application/json), text/plain, _/_”,“Content-Type”:“application/x-www-form-urlencoded”,“Authorization”:“Basic xxxxxxxxxxxxxxxx”,“User-Agent”:“axios/0.19.2”},“transformRequest”:[null],“transformResponse”:[null],“timeout”:0,“xsrfCookieName”:“XSRF-TOKEN”,“xsrfHeaderName”:“X-XSRF-TOKEN”,“maxContentLength”:-1}}}

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

**Which Endpoint/s?**  
`https://zoom.us/oauth/token?code=${req.body.code}&grant_type=authorization_code&redirect_uri=https://app.butternbinge.com/trending`

**How To Reproduce (If applicable)**  
Steps to reproduce the behavior:  
Here’s the code I am using

```
const zoomRes = await axios.post(
  `https://zoom.us/oauth/token?code=${req.body.code}&grant_type=authorization_code&redirect_uri=https://app.butternbinge.com/trending`,
  null, {
    headers: {
      'Authorization': `Basic ${Buffer.from('ClientId' + ":" + 'ClientSecret')
        .toString("base64")}`,
      'Content-Type': 'application/x-www-form-urlencoded',
    }
  })

```

**Additional context**  
I’ve tried modifying the request by changing the Content-Type to ‘application/json’ and the redirect URL to the one generated from the console. While I was experimenting, I only got 400 and 403 errors.

---

<div class="post-metadata">

**Author:** ![MaxM](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/maxm/32/42303_2.png) [@MaxM](https://devforum.zoom.us/u/MaxM)\
**Post date:** [October 4, 2021, 10:33pm UTC](https://devforum.zoom.us/t/getting-a-400-error-when-attempting-to-get-an-access-token-from-zoom-us-oauth-token/58289/2 "2021-10-04T22:33:15Z")

</div>

Hey @transcodedinc,

Thank you for reaching out to the Zoom Developer Forum. When making this request, are you receiving a body along with the 401 status code? I’m wondering if this has more information indicating the exact issue.

Thanks,  
Max

---

<div class="post-metadata">

**Author:** ![transcodedinc](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/transcodedinc/32/20522_2.png) [@transcodedinc](https://devforum.zoom.us/u/transcodedinc)\
**Post date:** [October 6, 2021, 5:42pm UTC](https://devforum.zoom.us/t/getting-a-400-error-when-attempting-to-get-an-access-token-from-zoom-us-oauth-token/58289/3 "2021-10-06T17:42:43Z")

</div>

I will try to collect all the details to resolve it.

I do not get anything specific besides it. Here’s how it looks in preview:

```auto
error: {message: "Request failed with status code 400", name: "Error",…}
config: {,…}
data: null
headers: {Accept: "application/json, text/plain, */*", Content-Type: "application/x-www-form-urlencoded",…}
Accept: "application/json, text/plain, */*"
Authorization: "Basic Uxxxxxxp"
Content-Type: "application/x-www-form-urlencoded"
User-Agent: "axios/0.19.2"
maxContentLength: -1
method: "post"
timeout: 0
transformRequest: [null]
0: null
transformResponse: [null]
0: null
url: "https://zoom.us/oauth/token?code=P1Lm6LxxxxxdXff7hFNg&grant_type=authorization_code&redirect_uri=https://app.butternbinge.com/trending"
xsrfCookieName: "XSRF-TOKEN"
xsrfHeaderName: "X-XSRF-TOKEN"
message: "Request failed with status code 400"
name: "Error"
stack: "Error: Request failed with status code 400\n at createError (/workspace/node_modules/axios/lib/core/createError.js:16:15)\n at settle (/workspace/node_modules/axios/lib/core/settle.js:17:12)\n at IncomingMessage.handleStreamEnd (/workspace/node_modules/axios/lib/adapters/http.js:236:11)\n at IncomingMessage.emit (events.js:412:35)\n at endReadableNT (internal/streams/readable.js:1317:12)\n at processTicksAndRejections (internal/process/task_queues.js:82:21)"

```

My OAuth app has the following setup:  
Intend to publish: Yes  
Account Level

Our plan: All that we intend to do with it is to help users to create zoom meetings. The process is: user logs in (gets token), and thereafter can create events.

We also haven’t published the zoom project yet. Could something be related to the console settings blocking us from getting access tokens successfully?

Here’s what we have in the console settings:

App credentials:  
Production:  
After Zoom approves your app, the live app on the Zoom Marketplace will use these credentials.  
To use production credentials without publishing your app, please generate a [Publishable URL]

Redirect URL for OAuth: https:// app .butternbinge.com/trending // _splitted due to forum rules_  
Subdomain check — turned off  
Add allow lists:  
https:// app .butternbinge.com/ // _splitted due to forum rules_  
http:// localhost:3000 // _splitted due to forum rules_  
https:// app .butternbinge.com/trending // _splitted due to forum rules_

Feature:  
Event subscriptions and Chat Subscription — turned off.

Scopes:  
View all user meetings/meeting:read:admin  
View and manage all user meetings/meeting:write:admin  
View all user information/user:read:admin

Test the App Locally:  
As I understood the process, in this section I need to install it before using it (logging with URL redirection, etc). So I did.

Additionally, I tested it all **not locally** (localhost or local server, etc).

Thank you 🙏

---

<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:** [October 12, 2021, 10:00am UTC](https://devforum.zoom.us/t/getting-a-400-error-when-attempting-to-get-an-access-token-from-zoom-us-oauth-token/58289/4 "2021-10-12T10:00:08Z")

</div>

Hi @transcodedinc,

In the console/preview, where you see the error object, can you expand this to reveal the `errorMessage` associated with the 400?

 ![image](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/7/7/7733aaf3cd9460790b82e699d3379244d0562852.png)

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:** [November 11, 2021, 8:00pm UTC](https://devforum.zoom.us/t/getting-a-400-error-when-attempting-to-get-an-access-token-from-zoom-us-oauth-token/58289/5 "2021-11-11T20:00:41Z")

</div>

Closed on November 11, 2021, 8:00pm UTC

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