# Oauth app : unsupported\_grant\_type

**URL:** <https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688>\
**Category:** API and Webhooks\
**Created:** [December 3, 2022, 1:47pm UTC](https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688 "2022-12-03T13:47:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![dem](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dem](https://devforum.zoom.us/u/dem)\
**Post date:** [December 3, 2022, 1:47pm UTC](https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688/1 "2022-12-03T13:47:15Z")

</div>

I created an OAuth app.  
PHP:  
I requested user authrorization and got the code.  
With that code ( $code ), I’m trying to request access token.

```auto
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://zoom.us/oauth/token");
curl_setopt($ch, CURLOPT_POST, TRUE);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
	"Host: zoom.us",
    "Authorization: Basic ".$authorization,
    "Content-Type: application/x-www-form-urlencoded"
));
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
	'code' => $code,
	'grant_type' => 'authorization_code',
	'redirect_uri' => $redirect_uri,
));

$data = curl_exec($ch);

```

where $code is the code I got, $authorization is a base64\_encode Client\_ID:Client\_Secret and $redirect\_uri the needed url (whitelisted)

Unfortunatly I got an error:

`{"reason":"unsupported grant type","error":"unsupported_grant_type"}`

What’s wrong with the grant\_type ?

---

<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:** [December 6, 2022, 5:43pm UTC](https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688/2 "2022-12-06T17:43:16Z")

</div>

When you are sending your request to authorize, are you using a code challenge? If so, make sure that you are using a code\_verifier here to complete the PKCE flow.

We have more information on this [here](https://marketplace.zoom.us/docs/guides/auth/oauth/#:~:text=If%20Zoom%20verifies%20that%20the%20code_challenge%20and%20the%20code_verifier%20values%20match%2C%20the%20token%20endpoint%20continues%20processing.%20If%20they%20do%20not%20match%2C%20you%20will%20receive%20an%20invalid_grant%20error.).

Let me know if that helps.

---

<div class="post-metadata">

**Author:** ![dem](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dem](https://devforum.zoom.us/u/dem)\
**Post date:** [December 7, 2022, 12:24pm UTC](https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688/3 "2022-12-07T12:24:53Z")

</div>

I don’t use PKCE flow its optionnal (on the documentation).

I request a user authorization with something like:

```auto
https://zoom.us/oauth/authorize?response_type=code&client_id=7lstjK9NTyett_oeXtFiEQ&redirect_uri=https://example.com

```

I do confirm that redirect\_uri gives me a code like:

```auto
https://example.com/?code=obBEe8ewaL_KdyNjniT4KPd8ffDWt9fGB

```

ThenI use this code value in the script above and the answer is :

`Oauth app : unsupported_grant_type`

According to the [documentation](https://marketplace.zoom.us/docs/guides/auth/oauth/#step-2-request-access-token) I don’t understand what’s wrong.

---

<div class="post-metadata">

**Author:** ![dem](https://avatars.discourse-cdn.com/v4/letter/d/9fc348/32.png) [@dem](https://devforum.zoom.us/u/dem)\
**Post date:** [December 7, 2022, 1:59pm UTC](https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688/4 "2022-12-07T13:59:04Z")

</div>

Forget it @MaxM😉 Thanks for your help. I found an other solution. I swiched from OAuth app to [Server-to-Server OAuth](https://marketplace.zoom.us/docs/guides/build/server-to-server-oauth-app/). And it works !

---

<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:** [December 7, 2022, 10:13pm UTC](https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688/5 "2022-12-07T22:13:06Z")

</div>

Glad to hear you have a path forward!

---

<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:** [December 7, 2022, 10:13pm UTC](https://devforum.zoom.us/t/oauth-app-unsupported-grant-type/79688/6 "2022-12-07T22:13:10Z")

</div>

Closed on December 7, 2022, 10:13pm UTC


