# About Client ID/Secret for API using OAuth: Error message "Authentication Unsuccessful: Request failed with status code 400"

**URL:** <https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597>\
**Category:** Authentication\
**Created:** [March 13, 2023, 6:54am UTC](https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597 "2023-03-13T06:54:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![y\_akagi](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/y_akagi/32/46381_2.png) [@y\_akagi](https://devforum.zoom.us/u/y_akagi)\
**Post date:** [March 13, 2023, 6:54am UTC](https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597/1 "2023-03-13T06:54:47Z")

</div>

### Format Your New Topic as Follows:

ENDPOINT: ‘[https://zoom.us/oauth/token](https://zoom.us/oauth/token)’

**Description**  
I’m creating an in-house OAuth app with Node.js.  
An error is returned even if the Client ID and Client Secret are set as follows when obtaining a Token.  
(Since the company wants to create with OAuth, it cannot be created with JWT etc.)  
Other languages such as Python will give the same error.

It may be difficult to understand, but thank you for your reply.

```auto
headers: {
    Authorization: `Basic ${Buffer.from(
     `${CLIENT_ID}:${CLIENT_SECRET}`
     ).toString("base64")}`,
     'Content-Type': 'application/x-www-form-urlencoded'
},

```

**Error?**  
{“message”:“Authentication Unsuccessful: Request failed with status code 400”}

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [March 13, 2023, 6:56pm UTC](https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597/2 "2023-03-13T18:56:50Z")

</div>

Hi @y_akagi ,

You may have included this in your request and not shared here, but I do not see a [request body](https://marketplace.zoom.us/docs/guides/auth/oauth/#step-2-request-access-token) with the appropriate info being sent for the access token:

 ![Screenshot 2023-03-13 at 11.55.04 AM](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/9/f/9f5cc94867defcc34e3f6a56896b2b85b4b49319.png)

See our [Postman workspace](https://www.postman.com/zoom-developer/workspace/zoom-public-workspace/request/22097587-82698a23-7af5-4f3f-bf2e-a62c3eb8903d) for everything that’s needed. You can also fork the space and generate the token using the requests we’ve built.

Please update me 🙂

---

<div class="post-metadata">

**Author:** ![y\_akagi](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/y_akagi/32/46381_2.png) [@y\_akagi](https://devforum.zoom.us/u/y_akagi)\
**Post date:** [March 14, 2023, 3:51am UTC](https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597/4 "2023-03-14T03:51:23Z")

</div>

Hi @gianni.zoom

Thank you for your answer

It was built by someone in-house, but I understand that the parameters are insufficient for use with OAuth.

Could you please tell me where and how to fix the following?

```auto
const axios = require("axios");
const qs = require("query-string");
const keyv = require("./keyv")
const config = require("../config");
const urlParams = new URLSearchParams(window.location.search)
const CODE = urlParams.get("code")

const getToken = async () => {
  try {
    const { ACCOUNT_ID, CLIENT_ID, CLIENT_SECRET, ENDPOINT } = config;
    const request = await axios.post(
      ENDPOINT,
      qs.stringify({
        grant_type: "authorization_code",
        // account_id: ACCOUNT_ID,
        code: CODE,
        redirect_uri: `https://resonant-triode-379502.an.r.appspot.com/`, //https://zoom.us/oauth/authorize?response_type=code&client_id=UGn0YY2iQynB9q_VSfn4Q&redirect_uri=https%3A%2F%2Fresonant-triode-379502.an.r.appspot.com
      }),
      {
        headers: {
          'Authorization': `Basic ${Buffer.from(
            `${CLIENT_ID}:${CLIENT_SECRET}`
          ).toString("base64")}`,
          'Content-Type': 'application/x-www-form-urlencoded',
        },
      }
    );
    const { access_token, expires_in } = await request.data;
    return { access_token, expires_in, error: null };
  } catch (error) {
    return { access_token: null, expires_in: null, error };
  }
};

const setToken = async ({ access_token, expires_in }) => {
  await keyv.set("access_token", access_token, expires_in);
};

module.exports = { getToken, setToken };

```

I’m deploying and using/testing on GCP, but after making this change I get a 500 error.

Thank you

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [March 14, 2023, 4:50am UTC](https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597/5 "2023-03-14T04:50:23Z")

</div>

Hi @y_akagi ,

Here’s a code snippet for you: [Postman](https://www.postman.com/zoom-developer/workspace/zoom-public-workspace/request/22097587-82698a23-7af5-4f3f-bf2e-a62c3eb8903d?ctx=code)

In the example, the request body key value pairs are in a var = data, which is then invoked on line 16 after headers.

Does that help?

---

<div class="post-metadata">

**Author:** ![y\_akagi](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/y_akagi/32/46381_2.png) [@y\_akagi](https://devforum.zoom.us/u/y_akagi)\
**Post date:** [March 15, 2023, 3:00am UTC](https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597/6 "2023-03-15T03:00:47Z")

</div>

thank you.  
This issue has been resolved.  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![gianni.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/gianni.zoom/32/32523_2.png) [@gianni.zoom](https://devforum.zoom.us/u/gianni.zoom)\
**Post date:** [March 16, 2023, 1:14am UTC](https://devforum.zoom.us/t/about-client-id-secret-for-api-using-oauth-error-message-authentication-unsuccessful-request-failed-with-status-code-400/84597/7 "2023-03-16T01:14:40Z")

</div>

Great to hear! Take care.
