# OAuth Token Request Returns a Truncated Token

**URL:** <https://devforum.zoom.us/t/oauth-token-request-returns-a-truncated-token/81010>\
**Category:** Meetings\
**Tags:** api\
**Created:** [January 5, 2023, 2:58pm UTC](https://devforum.zoom.us/t/oauth-token-request-returns-a-truncated-token/81010 "2023-01-05T14:58:57Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![reggie](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/reggie/32/44212_2.png) [@reggie](https://devforum.zoom.us/u/reggie)\
**Post date:** [January 5, 2023, 2:58pm UTC](https://devforum.zoom.us/t/oauth-token-request-returns-a-truncated-token/81010/1 "2023-01-05T14:58:58Z")

</div>

The access\_token is always 632 characters long, and when I test it in Postman it works fine

Postman Code:

```auto
using System;
using RestSharp;
namespace HelloWorldApplication {
  class HelloWorld {
    static void Main(string[] args) {
      var client = new RestClient("https://zoom.us/oauth/token?account_id=VfdA06Q9TQe31jH7oRutuQ&grant_type=account_credentials");
      client.Timeout = -1;
      var request = new RestRequest(Method.POST);
      request.AddHeader("Authorization", "Basic ####");
      request.AddHeader("Cookie", "####");
      var body = @"";
      request.AddParameter("text/plain", body, ParameterType.RequestBody);
      IRestResponse response = client.Execute(request);
      Console.WriteLine(response.Content);
    }
  }
}

```

I have a limitation that prevents me from using RestSharp. As such, I am using System.Net.Http in my application, but the access\_token is always 533 characters long. I get unauthorized response whenever I use that token which is what alerted me that something may be wrong with it.

System.Net.Http Code

```auto
using System;
using System.Collections.Generic;
using System.Net.Http;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ConsoleApp_Test_ZoomCreateMeeting
{
    class Program
    {
        static void Main(string[] args)
        {
            //Get current token age
        
             // Get the get credentials

            // Build the request body
            var authRequestBody = new FormUrlEncodedContent(new[]
            {
            new KeyValuePair<string, string>("grant_type", "client_credentials"),
            new KeyValuePair<string, string>("client_id", "####"),
            new KeyValuePair<string, string>("client_secret", "####")
        });

            // Set up the HTTP client
            var authClient = new HttpClient();
            authClient.BaseAddress = new Uri("https://zoom.us/");

            // Send the request and get the response
            HttpResponseMessage authResponse = authClient.PostAsync("oauth/token", authRequestBody).Result;

            string content = authResponse.Content.ReadAsStringAsync().Result;
            long contentLength = authResponse.Content.Headers.ContentLength ?? 0;

            string responseContent = authResponse.Content.ReadAsStringAsync().Result;

            // Parse the JSON response
            JObject jsonResponse = JsonConvert.DeserializeObject<JObject>(responseContent);

            // Create an instance of JsonSerializerSettings and set the ReferenceLoopHandling property to Ignore
            JsonSerializerSettings serializerSettings = new JsonSerializerSettings();
            serializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;

            // Serialize the jsonResponse object using the JsonSerializerSettings object
            string serializedJsonResponse = JsonConvert.SerializeObject(jsonResponse, serializerSettings);

            // Extract the access_token property (value<t>)
            string currentToken = jsonResponse["access_token"].Value<string>();           

            Console.WriteLine("Current Token: " + currentToken);        
            
        }

    }
}

```

Any ideas on a solution here?

I tried to request an OAuth token from the Zoom API, and though I received one, the access\_token attribute is being cut short
