APIs & Integrations

dianacch
参加者

Unauthorized

解決

i have a rest service  is locate in a host with certificate http and i try to consume the api hubspot but when i send a request i have a issue.

this is  the error:

The remote server returned an error: 401 Unauthorized, but in my local works fine.

I dont now what is the problem.

 

 

0 いいね!
1件の承認済みベストアンサー
Derek_Gervais
解決策
元HubSpot社員
元HubSpot社員

Unauthorized

解決

Hi @dianacch ,

 

Apologies for the delay here. As far as I understand, it's not required that your client has an SSL certificate in order to make requests to the HubSpot API. This appears to be validated in this stack overflow article. That said, I'm not really clear on what exactly is happening here. A 401 with a hapikey almost always means one of two things:

  1. The request is being malformed in some way, so that the hapikey isn't being properly included
  2. The hapikey is a developer hapikey (from a developer account) and is used to make requests to a test or production portal

Can you potentially log the raw request body you're sending to the HubSpot API (minus the actual hapikey) so that we can take a closer look? Additionally, can you confirm the Hub ID of the account you're using?

元の投稿で解決策を見る

4件の返信
Derek_Gervais
元HubSpot社員
元HubSpot社員

Unauthorized

解決

Hey @dianacch ,

 

Are you including the proper authentication with your requests to the HubSpot API? Each request requires either an API key (included as a query parameter, like this: `&hapikey=xxxx`) or an access token (included in the `Authorization` header, like this: `Bearer xxxxxxx`). If you have some more details about the requests that are failing, please don't hesitate to post them here (without any sensitive authentication details) and we can help troubleshoot what's going on.

 

You can find some more details on authentication here: https://developers.hubspot.com/docs/methods/auth/oauth-overview

dianacch
参加者

Unauthorized

解決

@Derek_Gervais yes, i send the api key in the request:
https://api.hubapi.com/contacts/v1/contact/?hapikey=apikey

When i send a request from my localhost works fine but when my service is hosting in a host without certificate https doesn't works.

The certificate is the problem ? Is it necessary have a host with certificate https ?? 

 

0 いいね!
Derek_Gervais
解決策
元HubSpot社員
元HubSpot社員

Unauthorized

解決

Hi @dianacch ,

 

Apologies for the delay here. As far as I understand, it's not required that your client has an SSL certificate in order to make requests to the HubSpot API. This appears to be validated in this stack overflow article. That said, I'm not really clear on what exactly is happening here. A 401 with a hapikey almost always means one of two things:

  1. The request is being malformed in some way, so that the hapikey isn't being properly included
  2. The hapikey is a developer hapikey (from a developer account) and is used to make requests to a test or production portal

Can you potentially log the raw request body you're sending to the HubSpot API (minus the actual hapikey) so that we can take a closer look? Additionally, can you confirm the Hub ID of the account you're using?

dianacch
参加者

Unauthorized

解決

Thanks a lot @Derek_Gervais,  your post saved me.

The problem was in the host configuration hahahaha