# Server to server oauth "unsupported grant type"

**URL:** <https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136>\
**Category:** API and Webhooks\
**Created:** [June 30, 2023, 3:28pm UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136 "2023-06-30T15:28:49Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![thkyc](https://avatars.discourse-cdn.com/v4/letter/t/f9ae1b/32.png) [@thkyc](https://devforum.zoom.us/u/thkyc)\
**Post date:** [June 30, 2023, 3:28pm UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/1 "2023-06-30T15:28:49Z")

</div>

Hi,

I’m trying to update our node.js app to use Server to server oauth. I have enabled Server-to-server OAuth app in role management. All the settings in in the Server to server oauth app seeem to be ok. The app is published.

This is the error I get: Error: Failed to generate access token: {“reason”:“unsupported grant type”,“error”:“unsupported\_grant\_type”}

Is the grant type supposed to be “account\_credentials”? Can you please review my code. I have double checked that clientid,secret and accountid are correct.

Here is my code:

```auto
 private generateOauth(): Promise<string> {
   const clientID: string = "xxx";
   const clientSecret: string = "xxx";
   const accountID = "xxx";
 
   const authHeader = Buffer.from(`${clientID}:${clientSecret}`).toString('base64');
 
   const data = JSON.stringify({
     grant_type: 'account_credentials',
     account_id: accountID,
   });
 
   const options = {
     hostname: 'zoom.us',
     path: '/oauth/token',
     method: 'POST',
     headers: {
       'Content-Type': 'application/json',
       'Authorization': `Basic ${authHeader}`,
       'Content-Length': data.length,
     },
   };
 
   return new Promise((resolve, reject) => {
     const req = https.request(options, res => {
       let responseData = '';
 
       res.on('data', chunk => {
         responseData += chunk;
       });
 
       res.on('end', () => {
         if (res.statusCode === 200) {
           const response = JSON.parse(responseData);
           resolve(response.access_token);
         } else {
           reject(new Error(`Failed to generate access token: ${responseData}`));
         }
       });
     });
 
     req.on('error', error => {
       reject(error);
     });
 
     req.write(data);
     req.end();
   });
 }

```

---

<div class="post-metadata">

**Author:** ![gsingh28](https://avatars.discourse-cdn.com/v4/letter/g/5f8ce5/32.png) [@gsingh28](https://devforum.zoom.us/u/gsingh28)\
**Post date:** [August 1, 2023, 2:03am UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/2 "2023-08-01T02:03:30Z")

</div>

I get the same error when posting to /oauth/token from my python script. According the links below, setting the content type to “application/x-www-form-urlencoded” in the header might solve your problem. Wasn’t that simple for me, unfortunately, I’m still stuck.

- [Zoom API Oauth | Error: unsupported\_grant\_type - Zoom Community](https://community.zoom.com/t5/Marketplace/Zoom-API-Oauth-Error-unsupported-grant-type/m-p/62700)
- [Invalid Grant Type for Oauth app using PHP - #19 by alanj](https://devforum.zoom.us/t/invalid-grant-type-for-oauth-app-using-php/87191/19)

---

<div class="post-metadata">

**Author:** ![MultiplayerSession](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/multiplayersession/32/66446_2.png) [@MultiplayerSession](https://devforum.zoom.us/u/MultiplayerSession)\
**Post date:** [August 1, 2023, 1:37pm UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/3 "2023-08-01T13:37:16Z")

</div>

The `grant_type` looks correct. I don’t think this endpoint accepts JSON (even though it responds with JSON); try formatting your request body as a query string and declaring the `application/x-www-form-urlencoded` content type instead. Our application sends this header: `Content-Type: application/x-www-form-urlencoded; charset=utf-8`

---

<div class="post-metadata">

**Author:** ![thkyc](https://avatars.discourse-cdn.com/v4/letter/t/f9ae1b/32.png) [@thkyc](https://devforum.zoom.us/u/thkyc)\
**Post date:** [August 17, 2023, 10:09am UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/4 "2023-08-17T10:09:05Z")

</div>

> [@MultiplayerSession](#):
>
> The `grant_type` looks correct. I don’t think this endpoint accepts JSON (even though it responds with JSON); try formatting your request body as a query string and declaring the `application/x-www-form-urlencoded` content type instead. Our application sends this header: `Content-Type: application/x-www-form-urlencoded; charset=utf-8`

Thanks for your answers. Got it working by following your instructions.

---

<div class="post-metadata">

**Author:** ![jonahwills8770](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jonahwills8770/32/52235_2.png) [@jonahwills8770](https://devforum.zoom.us/u/jonahwills8770)\
**Post date:** [November 12, 2023, 2:27pm UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/5 "2023-11-12T14:27:45Z")

</div>

Your code looks correct, and you are using the correct grant type for Server-to-Server OAuth. Here are a few things to check:

- Make sure that your Server-to-Server OAuth app is enabled and published.
- Make sure that your client ID, client secret, and account ID are correct.
- Make sure that you are using the correct Content-Type header: `application/json`.
- Make sure that you are sending the request to the correct endpoint: `https://zoom.us/oauth/token`.

If you are still getting the same error, try using a different HTTP client library, such as Axios or Node-Fetch. You can also try using a different programming language, such as Python or Java, to see if you get the same error.

If you are still having trouble, please contact Zoom support for assistance.

Here is an example of how to use Axios to generate an access token using the Server-to-Server OAuth grant type:

```javascript
const axios = require('axios');

async function generateOauth() {
  const clientID = 'YOUR_CLIENT_ID';
  const clientSecret = 'YOUR_CLIENT_SECRET';
  const accountID = 'YOUR_ACCOUNT_ID';

  const authHeader = Buffer.from(`${clientID}:${clientSecret}`).toString('base64');

  const response = await axios.post('https://zoom.us/oauth/token', {
    grant_type: 'account_credentials',
    account_id: accountID,
  }, {
    headers: {
      'Authorization': `Basic ${authHeader}`,
      'Content-Type': 'application/json',
    },
  });

  if (response.status === 200) {
    return response.data.access_token;
  } else {
    throw new Error(`Failed to generate access token: ${response.statusText}`);
  }
}

const accessToken = await generateOauth();

// Use the access token to make API requests to Zoom

```

---

<div class="post-metadata">

**Author:** ![jamesoleg2](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/jamesoleg2/32/53378_2.png) [@jamesoleg2](https://devforum.zoom.us/u/jamesoleg2)\
**Post date:** [November 13, 2023, 3:32pm UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/6 "2023-11-13T15:32:50Z")

</div>

Hello,

It looks like you’re trying to obtain an access token using the “account\_credentials” grant type for Server-to-Server OAuth with Zoom. The error you’re encountering, “unsupported\_grant\_type,” may be due to an incorrect grant type or a misconfiguration in your request.

In the Zoom API documentation, the grant type for Server-to-Server OAuth is typically “client\_credentials” instead of “account\_credentials.” Please try updating your `grant_type` to ‘client\_credentials’ like this:

javascriptCopy code

```auto
const data = JSON.stringify({
  grant_type: 'client_credentials',
  // other parameters...
});

```

Make sure to check the Zoom API documentation for the correct grant type and any additional parameters required for your specific use case.

If the issue persists, double-check your client ID, client secret, and account ID to ensure they are correctly set. Additionally, you might want to verify if there are any specific configurations required for Server-to-Server OAuth in the Zoom Developer Dashboard.

Hope this helps!

---

<div class="post-metadata">

**Author:** ![Sadek](https://avatars.discourse-cdn.com/v4/letter/s/e68b1a/32.png) [@Sadek](https://devforum.zoom.us/u/Sadek)\
**Post date:** [June 1, 2024, 8:10pm UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/7 "2024-06-01T20:10:11Z")

</div>

I am getting same issue… I am trying to create a zoom licensed user but stuck at getting the access token… If I use client\_credentials then cannot create a user: “This API does not support client credentials for authorization” if I use the other grant type, then says unsupported grant type…

---

<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:** [June 5, 2025, 11:46am UTC](https://devforum.zoom.us/t/server-to-server-oauth-unsupported-grant-type/91136/8 "2025-06-05T11:46:50Z")

</div>

Closed on June 5, 2025, 11:46am UTC

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