# {"reason":"Invalid Grant","error":"invalid\_grant"}

**URL:** <https://devforum.zoom.us/t/reason-invalid-grant-error-invalid-grant/106468>\
**Category:** Authentication\
**Tags:** api, s2s-oauth\
**Created:** [March 25, 2024, 6:54pm UTC](https://devforum.zoom.us/t/reason-invalid-grant-error-invalid-grant/106468 "2024-03-25T18:54:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Babele](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/babele/32/55679_2.png) [@Babele](https://devforum.zoom.us/u/Babele)\
**Post date:** [March 25, 2024, 6:54pm UTC](https://devforum.zoom.us/t/reason-invalid-grant-error-invalid-grant/106468/1 "2024-03-25T18:54:25Z")

</div>

Hello everybody,

I’m trying to generate a token from [https://zoom.us/oauth/token](https://zoom.us/oauth/token) and I’m receiving an error:

{“reason”:“Invalid Grant”,“error”:“invalid\_grant”}

I have checked that the authorization header is being well generated through this method:

private string GetAuthorizationHeader()  
{  
var plainText = $“{\_zoomMeetingConfiguration.ClientId}:{\_zoomMeetingConfiguration.ClientSecret}”;  
var plainTextBytes = ASCIIEncoding.ASCII.GetBytes(plainText);  
var encodedString = Convert.ToBase64String(plainTextBytes);  
return encodedString;  
}

I have double-checked that the ClientId and ClientSecret are correct according to our application. I’m calling the API like this:

var dict = new Dictionary\<string, string\>  
{  
{ “redirect\_uri”, \_zoomMeetingConfiguration.RedirectUri },  
{ “grant\_type”, “authorization\_code” },  
{ “code”, authorizationCode }  
};

Uri baseUri = new Uri(“[https://zoom.us](https://zoom.us)”);  
var requestBody = new FormUrlEncodedContent(dict);  
\_httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(“Basic”, GetAuthorizationHeader());  
\_httpClient.DefaultRequestHeaders.Host = baseUri.Host;  
var response = await \_httpClient.PostAsync(tokenPath, requestBody);

Can anybody please help me get what I’m doing wrong?

Thanks in advance.

---

<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 25, 2024, 8:31pm UTC](https://devforum.zoom.us/t/reason-invalid-grant-error-invalid-grant/106468/2 "2024-03-25T20:31:45Z")

</div>

Hey @Babele ,

Please review this troubleshooting guide: [Troubleshooting Server-to-Server Oauth access tokens](https://developers.zoom.us/blog/s2s-token-generation-troubleshoot/)

In addition to our token generation samples:

> **[Server-to-Server OAuth](https://developers.zoom.us/docs/internal-apps/s2s-oauth/#code-samples)**
>
> 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:** ![Babele](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/babele/32/55679_2.png) [@Babele](https://devforum.zoom.us/u/Babele)\
**Post date:** [March 26, 2024, 11:12am UTC](https://devforum.zoom.us/t/reason-invalid-grant-error-invalid-grant/106468/3 "2024-03-26T11:12:44Z")

</div>

Hey @gianni.zoom,

Thanks for your reply. It was missing some details. My application is the type OAuth, not the Server-to-Server Oauth.

Note that the error and the request are different than my scenario.

Thanks again for your attention.

---

<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 27, 2024, 7:13pm UTC](https://devforum.zoom.us/t/reason-invalid-grant-error-invalid-grant/106468/4 "2024-03-27T19:13:52Z")

</div>

Hi @Babele ,

Are you using a legacy OAuth application or Unified Build Flow?
