# Migration from JWT to Server-to-Server OAuth utilizing C# .Net Framework 4.7 Console App

**URL:** <https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133>\
**Category:** API and Webhooks\
**Created:** [September 14, 2023, 5:35pm UTC](https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133 "2023-09-14T17:35:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmcdaniel](https://avatars.discourse-cdn.com/v4/letter/c/a698b9/32.png) [@cmcdaniel](https://devforum.zoom.us/u/cmcdaniel)\
**Post date:** [September 14, 2023, 5:35pm UTC](https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133/1 "2023-09-14T17:35:24Z")

</div>

**Description:**  
We’re coding oAuth Server-to-Server connection to receive a token back. I have setup my header and body as follows in the code sample provided. I’m using the developer setup here: [Server-to-Server OAuth](https://developers.zoom.us/docs/internal-apps/s2s-oauth/)  
Please let me know exactly what goes into the head and body and if there is a better resource for this in a C# framework 4.7 console application.

**Error:**  
400 Bad Request

**Code to reproduce:**  
//HEADERS  
var headers = new Dictionary\<string, string\>  
{  
{ “Host”, “[zoom.us](http://zoom.us)”},  
{ “Authorization”, string.Format(“Basic clientId: {0}”, Convert.ToBase64String(Encoding.ASCII.GetBytes(ClientSecret))) },  
};  
//BODY  
FormUrlEncodedContent body = new FormUrlEncodedContent(  
new KeyValuePair\<string, string\>  
{  
new KeyValuePair\<string, string\>(“grant\_type”,“authorization\_code”),  
new KeyValuePair\<string, string\>(“account\_id”, ClientId)  
}  
);  
//RESPONSE  
var httpclient = new HttpClient();  
var response = Task.Run(() =\> httpclient.PostAsync( TokenEndpoint, body )).GetAwaiter().GetResult();

---

<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, 8:01pm UTC](https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133/2 "2023-09-14T20:01:35Z")

</div>

- The `Authorization` header value should be approximately `"Basic " + Convert.ToBase64String(Encoding.ASCII.GetBytes(ClientID + ":" + ClientSecret))` (not tested, but estimated from a different technology stack).
- Server-to-Server OAuth should be using the `grant_type` value `account_credentials`.
- Make sure the `account_id` value is set to the Account ID from your application credentials, not Client ID (as implied by your variable name).

---

<div class="post-metadata">

**Author:** ![cmcdaniel](https://avatars.discourse-cdn.com/v4/letter/c/a698b9/32.png) [@cmcdaniel](https://devforum.zoom.us/u/cmcdaniel)\
**Post date:** [September 14, 2023, 8:03pm UTC](https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133/3 "2023-09-14T20:03:06Z")

</div>

Thanks Christopher! I’ll test with those alterations.

---

<div class="post-metadata">

**Author:** ![cmcdaniel](https://avatars.discourse-cdn.com/v4/letter/c/a698b9/32.png) [@cmcdaniel](https://devforum.zoom.us/u/cmcdaniel)\
**Post date:** [September 25, 2023, 9:25pm UTC](https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133/4 "2023-09-25T21:25:58Z")

</div>

I receive a token now, however, had to use client\_credentials within the rest api.  
account\_credentials returns all null. account\_credentials does however, work in Postman.

---

<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:** [September 25, 2023, 9:35pm UTC](https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133/5 "2023-09-25T21:35:54Z")

</div>

Hi @cmcdaniel ,

Glad this is resolved. For future reference, here’s our Postman workspace with Server-to-Server OAuth set up: [Postman](https://www.postman.com/zoom-developer/workspace/zoom-public-workspace/folder/22097587-0021aa9e-17f5-478e-b106-dfb31b930153)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [September 26, 2023, 9:36pm UTC](https://devforum.zoom.us/t/migration-from-jwt-to-server-to-server-oauth-utilizing-c-net-framework-4-7-console-app/95133/6 "2023-09-26T21:36:26Z")

</div>

Closed on September 26, 2023, 9:36pm UTC

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
