Invalid_access error

I want to fetch all topics by tag. I am sending a GET request to the URL https://discourse-url/tag/kind:feature.json. But I am getting the error "You are not permitted to view the requested resource. The API username or key is invalid.". Whereas my API-key and API-username are correct. What could be the problem?


Just to confirm, you can use the same header to request, say /admin/users.json? (I think that’s an admin route, but you can check in a web browser)

Getting 404 error for this url. I can fetch any topic by sending the request to /t/topic-id.json but not able to do any other GET query successfully. What could be the possible problem

Can you get I’m sure that URL should work.

Not able to get it. Same error 404.

Then you’re not passing the credentials correctly. You can search for examples of how to pass them in the header.

But I just tested this one:

    curl -s -X GET --header "Api-Key: $DISCOURSE_API_KEY" --header "Api-Username: $DISCOURSE_API_USER"

I am passing credentials correctly. I verified it by trying to fetch an internal topic by id which can’t be fetched without proper credentials. But seems like only working query I can do is on discourse-url/t/tid.json. Anything else simply returns error 403.

1 Like