Ruby Client is not working Private Apps

Hi,

i am using the newest version for the ruby client: Versin 16.0.1.

Then i run the follwoing code:

client = Hubspot::Client.new(access_token: 'PRIVATE APP TOKEN')
body = { properties: { name: 'DeathStar GmbH' }}
response = client.crm.companies.basic_api.create(body: body)

# This is the response:

ETHON: Libcurl initialized
ETHON: performed EASY effective_url=https://api.hubapi.com/crm/v3/objects/companies?hapikey= response_code=401 return_code=ok total_time=0.344603
Hubspot::Crm::Companies::ApiError: Error message: the server returns an error
HTTP status code: 401

So my question is: Why is there still `hapikey=` at the end of the url and is that a problem? I followed the DOCs of the API. Accounts Dashboard | HubSpot

What is the expected behaviour here.

@Garllon

HI.

I read this.

https://github.com/HubSpot/hubspot-api-ruby/blob/master/lib/hubspot/codegen/crm/companies/api/basic_api.rb#L138

In the default, `hapikey` looks like has priority than `oauth2`

auth_names = opts[:debug_auth_names] || ['hapikey', 'oauth2']

And It looks like has not setter to change priority.

https://github.com/HubSpot/hubspot-api-ruby/blob/master/lib/hubspot/codegen/crm/companies/api_client.rb#L322

Not a fundamental solution, but how about use this?

response = client.crm.companies.basic_api.create(body: body, {debug_auth_names: ['oauth2']})

Thanks.

Hi skimura,

thanks for the hint. The main problem is that the hubspot-api-client gem is not supporting Private Apps, which is preffered from Hubspot. So i started writing my own gem:

https://github.com/Farbfox/hubspot_client

Best regards