# Bad Request - OAuth Access Token Generation

**URL:** <https://devforum.zoom.us/t/bad-request-oauth-access-token-generation/101543>\
**Category:** Authentication\
**Created:** [January 10, 2024, 6:09am UTC](https://devforum.zoom.us/t/bad-request-oauth-access-token-generation/101543 "2024-01-10T06:09:10Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hrmeffortless](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/hrmeffortless/32/50541_2.png) [@hrmeffortless](https://devforum.zoom.us/u/hrmeffortless)\
**Post date:** [January 10, 2024, 6:09am UTC](https://devforum.zoom.us/t/bad-request-oauth-access-token-generation/101543/1 "2024-01-10T06:09:10Z")

</div>

I have created server to server OAuth App in marketplace  
My code like below  
string encodedCredentials = Convert.ToBase64String(Encoding.UTF8.GetBytes($“{clientId}:{clientSecret}”));

// Set up API request header  
var requestHeaders = new  
{  
ContentType = “application/x-www-form-urlencoded”,  
Authorization = $“Basic {encodedCredentials}”  
};

// Set up the body of the access token request  
var requestBody = new  
{  
grant\_type = “account\_credentials”,  
account\_id = accountId  
};

// Convert request body to URL-encoded form data  
string requestBodyString = string.Join(“&”, requestBody.GetType().GetProperties()  
.Select(property =\> $“{Uri.EscapeDataString(property.Name)}={Uri.EscapeDataString(property.GetValue(requestBody)?.ToString())}”));

// Send the POST request to the token API  
using (var httpClient = new HttpClient())  
{  
var requestContent = new StringContent(requestBodyString, Encoding.UTF8, “application/x-www-form-urlencoded”);

```
var response = await httpClient.PostAsync("https://zoom.us/oauth/token", requestContent);

if (response.IsSuccessStatusCode)
{
	// Parse and use the access token from the response
	string jsonResponse = await response.Content.ReadAsStringAsync();
	Console.WriteLine($"Access Token: {jsonResponse}");
}

```

}  
but getting Bad request in response  
My Plan is basic plan

 ![App_Screen](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/b/6/b6b422783e7499522938bf98482f3b6cf2d96382.png)

---

<div class="post-metadata">

**Author:** ![ojus.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/ojus.zoom/32/734_2.png) [@ojus.zoom](https://devforum.zoom.us/u/ojus.zoom)\
**Post date:** [January 10, 2024, 11:11pm UTC](https://devforum.zoom.us/t/bad-request-oauth-access-token-generation/101543/2 "2024-01-10T23:11:12Z")

</div>

Can you follow this blog: [Troubleshooting Server-to-Server Oauth access tokens](https://developers.zoom.us/blog/s2s-token-generation-troubleshoot/) to troubleshoot the error?
