belong-inc / go-hubspot

HubSpot API Go client
Apache License 2.0
35 stars 26 forks source link

Private apps support #8

Closed kk-no closed 2 years ago

kk-no commented 2 years ago

Is your feature request related to a problem? Please describe. HubSpot added private apps (scoped api key) auth. go-hubspot needs to support this as well. https://developers.hubspot.com/docs/api/private-apps

Sample of the api call using private apps from HubSpot.

axios.get('https://api.hubapi.com/crm/v3/objects/contacts',
  {
    headers: {
      'Authorization': `Bearer ${YOUR_TOKEN}`,
      'Content-Type': 'application/json'
    }
  },
  (err, data) => {
    // Handle the API response
  }
);

Describe the solution you'd like As with API key and OAuth, we should be able to pass private apps token to the client in the form of an Option.

Describe alternatives you've considered

Additional context On another note, APIKey will be discontinued on November 30 2022. https://developers.hubspot.com/changelog/upcoming-api-key-sunset

thenoakes commented 2 years ago

As I have been finding this library useful and have been working with private apps, I opened a PR here which should deal with this 🤞 #10