Chinchilla-Software-Com/HubSpot.NET

Can't connect with OAuth

Closed this issue · 1 comments

Hi all

I'm having trouble connecting to HubSpot with the OAuth method.

`var clientId = "xxxxxxx";
var clientSecret = "xxxxxxx";
var authCode = "xxxxxxxxx";
var token = new HubSpotToken();

    var oAuthApi = new HubSpotOAuthApi(HubSpotBaseClient.BaseUrl, clientId, clientSecret);
    try
    {
        token = oAuthApi.Authorize(authCode, "http://localhost:5001/v1/profiles/hubspot/callback");
    }
    catch (Exception e)
    {
        Console.WriteLine(e);
        throw;
    }`

This is my current code, the authCode i get from copy pasting the install url from my HubspotApp.

Every time I run this piece of code I get a null as token. I can't debug the actual code from the package aswell.

Thank you fro helping me out :)

ClientID/ClientSecret OAuth has been deprecated by HubSpot. You should move to using PATs. See https://community.hubspot.com/t5/Developer-Announcements/Upcoming-API-Key-Sunset/m-p/642739