Trouble with api_token authorization at https://api.inaturalist.org/v1/docs/#!/Comments/post_comments

Please fill out the following sections to the best of your ability, it will help us investigate bugs if we have this information at the outset. Screenshots are especially helpful, so please provide those if you can.

Platform (Android, iOS, Website): Website

App version number, if a mobile app issue (shown under Settings): base url: /v1 , api version: 1.3.0

Browser, if a website issue (Firefox, Chrome, etc) : Firefox, curl

URLs (aka web addresses) of any relevant observations or pages: https://api.inaturalist.org/v1/docs/#!/Comments/post_comments

Screenshots of what you are seeing (instructions for taking a screenshot on computers and mobile devices: https://www.take-a-screenshot.org/):

Description of problem (please provide a set of steps we can use to replicate the issue, and make as many as you need.): Unauthenticated gets work fine. For example, getting an observation by id. POSTing a comment with an API authorization header results in a 401.

Step 1: Get an api_token at https://www.inaturalist.org/users/api_token (log in as necessary)

Step 2: Authorize API key through web site (paste value of key and authorize … ! goes to i and header value is displayed.

Step 3: Add request body through web page, setting type, parent id and body comment.

Step 4: Try it!

Result: 401 response code and ```
{
“error”: {
“original”: {
“error”: “You need to sign in or sign up before continuing.”
}
},
“status”: 401
}


Same failure when using curl copied and pasted from web browser.

Thanks for the bug report. Also thanks for the screenshot, but I have removed it from the post because it contained your JWT which should be kept private. I’ll take a look at this and get back to you.

At a quick glance, looks like the problem might be the quotes around the authorization key. You have 'Authorization: "JWT"', but it should be 'Authorization: JWT'. Try removing those internal quotes and trying again

1 Like

that worked! thanks. I figured it was something silly I was doing.

1 Like