# POST Error on Accesstoken

**URL:** <https://devforum.zoom.us/t/post-error-on-accesstoken/11941>\
**Category:** API and Webhooks\
**Created:** [April 7, 2020, 6:14pm UTC](https://devforum.zoom.us/t/post-error-on-accesstoken/11941 "2020-04-07T18:14:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jesuspampin](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jesuspampin](https://devforum.zoom.us/u/jesuspampin)\
**Post date:** [April 7, 2020, 6:14pm UTC](https://devforum.zoom.us/t/post-error-on-accesstoken/11941/1 "2020-04-07T18:14:58Z")

</div>

I’m getting errors making the POST request with the autorization code to get the access token. I tried different ways but I’m getting always an ‘Unexpected sending error’. This is the c# code of my last try. What is wrong?

```
			var request = HttpWebRequest.Create("https://zoom.us/oauth/token");
			request.ContentType = "application/x-www-form-urlencoded";
			request.Method = "POST";

			string base64dat = Base64Encode("XXXXXXXXXXXX" + ":" + "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX");
			request.Headers.Add("Authorization", "Basic " + base64dat);

			string postData = "grant_type=authorization_code&code=" + code + "&redirect_uri=" + "https://app.com";

			var data = Encoding.ASCII.GetBytes(postData);
			request.ContentLength = data.Length;

			using (var stream = request.GetRequestStream())
			{
				stream.Write(data, 0, data.Length);
			}

			var response = (HttpWebResponse)request.GetResponse();
			var responseString = new StreamReader(response.GetResponseStream()).ReadToEnd();
```

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 8, 2020, 8:36am UTC](https://devforum.zoom.us/t/post-error-on-accesstoken/11941/2 "2020-04-08T08:36:39Z")

</div>

Hey @jesuspampin,

Can you try removing `request.ContentType = "application/x-www-form-urlencoded";` ?

Let me know if that fixes it.

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![jesuspampin](https://avatars.discourse-cdn.com/v4/letter/j/54ee81/32.png) [@jesuspampin](https://devforum.zoom.us/u/jesuspampin)\
**Post date:** [April 8, 2020, 8:39am UTC](https://devforum.zoom.us/t/post-error-on-accesstoken/11941/3 "2020-04-08T08:39:16Z")

</div>

Thanks, I found on internet the solution. I put the parameters on the end of the url and add this line to enable all protocols.  
ServicePointManager.SecurityProtocol =  
SecurityProtocolType.Ssl3  
| SecurityProtocolType.Tls  
| SecurityProtocolType.Tls11  
| SecurityProtocolType.Tls12;

With this now I get the token and I can create the meeting. Thanks!!!.

---

<div class="post-metadata">

**Author:** ![tommy](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/tommy/32/72769_2.png) [@tommy](https://devforum.zoom.us/u/tommy)\
**Post date:** [April 8, 2020, 7:25pm UTC](https://devforum.zoom.us/t/post-error-on-accesstoken/11941/4 "2020-04-08T19:25:04Z")

</div>

Happy to hear you figured it out! 🙂

Thanks,  
Tommy

---

<div class="post-metadata">

**Author:** ![DeveloperBot](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/developerbot/32/12632_2.png) [@DeveloperBot](https://devforum.zoom.us/u/DeveloperBot)\
**Post date:** [August 21, 2020, 8:23pm UTC](https://devforum.zoom.us/t/post-error-on-accesstoken/11941/5 "2020-08-21T20:23:25Z")

</div>

Closed on August 21, 2020, 8:23pm UTC


