2

I am not able to authorize in accessing users from intercom using get request. This is what I have done:

import requests
headers = {
    'Authorization': 'Bearer {my accsess token}',
    'Accept': 'application/json',
    'Content-Type': 'application/json',
}
res = requests.get("https://api.intercom.io/users",headers=headers)

Error I am getting:

{"code":"token_unauthorized","message":"Not authorized to access resource"}

Please tell me what I am doing wrong. Thanks in advance.

s.singh
  • 62
  • 11

2 Answers2

1

I ran into this problem and it was due to a typo with my 'https://app.intercom.io/oauth' URL. This was hard to debug because the redirect URL was entered in an earlier command when you apply for a code, to get the bearer token. In my case, since I had a default Redirect URL when I applied for the OAuth, I just dropped the redirect URL from my call to 'https://app.intercom.io/oauth'.

cwingrav
  • 949
  • 1
  • 10
  • 10
0

Micheál here from the support team at Intercom

Access tokens for the Intercom REST API have the concept of scopes i.e permissions levels. Some operations require a token with elevated scopes. Listing all users is one such operation.

You can read more about access tokens including how to apply for elevated scopes here: https://developers.intercom.com/docs/personal-access-tokens

If you're still having issues please drop us a line at team@intercom.io and we can investigate further  

looneym
  • 301
  • 2
  • 8
  • I have Access Token which has full permission to all data and was working fine. However, since 13th June, I am receiving a "Token unauthorized error" while making an API request. I have tried deleting and creating a new app, regenerating tokens which did not help. Could you give more information on this, why it should happen? – Nazrin Guliyeva Jun 16 '21 at 15:52