Skip to main content
Source Link
Znurre
  • 143
  • 5

Unable to make API calls using access_token for private Stack Overflow Teams site

I am attempting to create an application utilizing the API to query data from our private Stack Overflow Teams site.

I've read through the documentation at https://api.stackexchange.com/docs/teams and https://api.stackexchange.com/docs/authentication, but to no avail.

My problem is simply that my requests to the API are denied with the following error:

{"error_id":403,"error_message":"`key` is not valid for passed `access_token`, token not found.","error_name":"access_denied"}

In order to keep our site anonymous, I will simply refer to it as "foosite" in the following text.

What I have done, in order:

  • Used the explicit OAuth API, server side, to generate an access_token using scope=access_team%7cstackoverflow.com%f2c%f2foosite,no_expiry.
  • Passed this access_token using the X-API-Access-Token header for my GET request to https://api.stackexchange.com/2.2/questions/unanswered/?team_url=stackoverflow.com%2fc%2ffoosite&site=stackoverflow&key=u9eRD30bklGv9t9gzDRSAQ((

What I have tried without luck:

  • URL-encoding the key parameter
  • Using applicationKey instead of key, but that seems to be part of the older API
  • Generating new access_token in case the other one would've been invalidated for whatever reason
  • Passing access_token as a query parameter same as for non-team sites, despite the documentation saying that it's not supported
  • Revoking access to the app and then granting it again

From what I can see, I do nothing wrong. Any ideas?