Connect to API via oAuth C#

I’ve switched to using RestSharp -- a generic REST interface helper -- that works with the OAuth Private app.

Create your private all, add perminssions and copy the Access Token to use in your Token here:

public class HubSpotConnection
{
	private RestClient client;

	private const string Token = "pat-na1-{number}-{number}-{more}-{and}-{more}";

	public void ProcessAutomationTickets()
	{
		client = new RestClient("https://api.hubapi.com")
		{
			Authenticator = new OAuth2AuthorizationRequestHeaderAuthenticator(Token,"Bearer")
		};

		var request = new RestRequest("/crm/v3/objects/tickets");
		var response = client.GetAsync(request).Result;
	}
}

All about RestSharp here: https://restsharp.dev/intro.html#introduction

MPT