In order to connect to the REST API, do we need to sign the query, for example HMAC SHA256? | Community
Skip to main content
Answered

In order to connect to the REST API, do we need to sign the query, for example HMAC SHA256?

  • Sep 29, 2021 4:32 PM UTC
  • 9 replies
  • 622 views

Even the example from the help guide (yes, I did enter the API token) doesn't work:

curl https://api.intercom.io/articles -X GET -H 'Authorization:Bearer <Your access token>' -H 'Accept:application/json' -H 'Content-Type: application/json'

 

Returns the following error:

{"type":"error.list","request_id":"001iuuadd47ehouu9ndg","errors":[{"code":"unauthorized","message":"Access Token Invalid"}]}

Best answer by Sam

I cannot reproduce this.

 

The only thing I can assume is your Authorization header is incorrect, as I have attempted to use this endpoint myself just now and it has worked perfectly.

View original

9 replies

Forum|alt.badge.img+1
  • Active User
  • Sep 30, 2021 8:56 AM UTC

Are you sure you copied the entire access token? It is case sensitive and common for people to miss the = symbol off of the end when copying the Access token from the OAuth page.


  • Author
  • Connector
  • Sep 30, 2021 11:25 AM UTC

Hi, yes the whole token is copied and pasted (case integrity is intact), but I’m not using OAuth as my app is not (and will never be) public.


  • Author
  • Connector
  • Sep 30, 2021 4:44 PM UTC

I'm beginning to suspect that all API calls use OAuth (which is not what the docs say - they imply OAuth is only used when creating a Public app).


Forum|alt.badge.img+1
  • Active User
  • Sep 30, 2021 4:50 PM UTC

You do not need to use OAuth for Private Apps.

 

You simply supply the Authorization header with the value: Bearer <Your Access Token>

 

Have you double checked that the token is 100% correct and that you're requesting the data for a workspace in which you own?


  • Author
  • Connector
  • Sep 30, 2021 7:06 PM UTC

cURL Request that results in "Invalid API Token" error 

Hi Sam, thanks for your replies, but it doesn't work for me.

Not in a LINUX terminal, Python or Google Sheets.

 

If I can't get the example to work to simply retrieve a list of articles with a GET request with cURL, then I am dead in the water.

 

24 hours and still waiting for support to get back to me on this.

 

It would help to have more specifics in the documentation about this as the error code is not giving me much to work with.


Forum|alt.badge.img+1
  • Active User
  • Sep 30, 2021 7:36 PM UTC

Usually access tokens end in a =, are you sure you've copied the whole token from the site?


  • Author
  • Connector
  • Sep 30, 2021 8:32 PM UTC

Hi Sam, you were right about the "=" - I usually double left-click to highlight text to be copied and it left off the "=" :/

 

Unfortunately still no luck (same error):

 

Ho hum...


Forum|alt.badge.img+1
  • Active User
  • Answer
  • Sep 30, 2021 8:36 PM UTC

I cannot reproduce this.

 

The only thing I can assume is your Authorization header is incorrect, as I have attempted to use this endpoint myself just now and it has worked perfectly.


  • Author
  • Connector
  • Sep 30, 2021 9:25 PM UTC

Just to confirm, you ran this command (with your Auth Token) on Linux and it worked for you?

 

curl https://api.intercom.io/articles -X GET -H 'Authorization: Bearer <Your access token>' -H 'Accept: application/json' -H 'Content-Type: application/json'

 

If so, it might be something odd with RaspberryPi OS (although it's handled more complicated cURL than this for other development tasks).