# Unsupported\_grant\_type while trying to get access and refresh token

**URL:** <https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728>\
**Category:** Authentication\
**Tags:** api\
**Created:** [July 13, 2023, 12:51am UTC](https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728 "2023-07-13T00:51:19Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SoftDev](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/softdev/32/50208_2.png) [@SoftDev](https://devforum.zoom.us/u/SoftDev)\
**Post date:** [July 13, 2023, 12:51am UTC](https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728/1 "2023-07-13T00:51:19Z")

</div>

I have been trying to get my access and refresh token using this zoom api [https://zoom.us/oauth/token](https://zoom.us/oauth/token), but couldn’t.

I followed all instruction in the documentation but keep getting “unsupported\_grant\_type” error message.

What could be the cause?

---

<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:** [July 13, 2023, 1:43pm UTC](https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728/2 "2023-07-13T13:43:01Z")

</div>

Verify the `grant_type` value that you’re sending. The value is different based on your application type (such as [OAuth](https://developers.zoom.us/docs/integrations/oauth/#step-2-request-access-token) or [Server-to-Server OAuth](https://developers.zoom.us/docs/internal-apps/s2s-oauth/#use-account-credentials-to-get-an-access-token)).

---

<div class="post-metadata">

**Author:** ![iechodev](https://avatars.discourse-cdn.com/v4/letter/i/b77776/32.png) [@iechodev](https://devforum.zoom.us/u/iechodev)\
**Post date:** [September 14, 2023, 6:12pm UTC](https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728/3 "2023-09-14T18:12:26Z")

</div>

I have the exact same problem. Below is my POST request. Any idea what I’m doing wrong?

```auto
POST https://zoom.us/oauth/token
Host: zoom.us
Authorization: Basic Q2xpZW50X0lEOkNsaWVudF9TZWNyZXQ=
Content-Type: application/x-www-form-urlencoded

{
    "code": "ZQ8AcoeUoo8hZ-D4XGRTqy928LGH1LSdA",
    "grant_type":"authorization_code",
    "redirect_uri":"http://localhost:3000/chat"
}

```

---

<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:** [September 14, 2023, 7:18pm UTC](https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728/4 "2023-09-14T19:18:37Z")

</div>

This request indicates a content type of `application/x-www-form-urlencoded`, but the body is formatted as `application/json`. Your body should look something like: `code= ********************************* &grant_type=authorization_code&redirect_uri=http%3A%2F%2Flocalhost%3A3000%2Fchat`

---

<div class="post-metadata">

**Author:** ![iechodev](https://avatars.discourse-cdn.com/v4/letter/i/b77776/32.png) [@iechodev](https://devforum.zoom.us/u/iechodev)\
**Post date:** [September 14, 2023, 7:45pm UTC](https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728/5 "2023-09-14T19:45:18Z")

</div>

Got it. Thanks Chris. The portion on this docs page confused me saying to pass in the request body for Oauth. Server-to-server Oauth is different.

Thanks for clearing that up. Got the token.

> **[OAuth for user authorized apps](https://developers.zoom.us/docs/integrations/oauth/)**
>
> The Zoom Developer Platform is an open platform that allows third-party developers to build applications and integrations upon Zoom’s video-first unified communications platform.

---

<div class="post-metadata">

**Author:** ![smit\_patel](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/smit_patel/32/49481_2.png) [@smit\_patel](https://devforum.zoom.us/u/smit_patel)\
**Post date:** [January 6, 2025, 1:13pm UTC](https://devforum.zoom.us/t/unsupported-grant-type-while-trying-to-get-access-and-refresh-token/91728/6 "2025-01-06T13:13:57Z")

</div>

The issue has been resolved by converting the data to the string type using qyerystring (Node js) as we are providing content type to “application/x-www-form-urlencoded”

so, we need to send the data like this.  
const qs = require(“querystring”);  
const data = qs.stringify({  
code: req?.query?.code,  
grant\_type: “authorization\_code”,  
redirect\_uri: “redirect-url”,  
});

NOTE: JSON.stringify will not work as we don’t have content type “application/json”
