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;
}
}
I wanted to migrate from API Key To Private app for my solution , I managed to use the private app token for a simple getcontacts call using HttpClient (Bearer autorization and private app token) but I could NOT make it work for HubSpotApi calls that requires ApiKey (i tried with OAUTH var api = new HubSpotApi("clientID", "clientSecret", "HubSpotAppID"); It says is expecting an API key instead)