ODK Central API User Authentication Issue

I have successfully configured and set my odk central instance. I want to use the API to access data from the platform. However, when I tried to authenticate the user, I am unsuccessful in getting the token.
Anytime I try, I get the response:

{
"message": "Could not authenticate with the provided credentials.",
"code": 401.2
}

Meanwhile, it is the same credentials that I use to login to the odk central on the web.
Please I need help on this issue.

Find attached a screenshot from postman.

1 Like

Pls anyone available to help me? I have tried everything but I am not able to log in using the API.

Some things to check:

  • Authorization is set to "No auth"
  • Body is sent as raw JSON
  • Cookie values are not being sent (this is important for requests after the first successful one)

You can also try importing the following:
Central.postman_collection.json (1.3 KB)

In case this is of interest to you or someone else -- I was looking for a quick way to get the full Central API specification into Postman. The best I found was:

The OpenAPI results I got: odk-central.yaml.zip (63.6 KB)

1 Like

Thanks very much for helping me with the answers. I imported the central postman collection that you sent and replaced them with the right URL and the credentials. It worked for the first time. However, subsequent requests give me the same error message.

I guess my postman is sending some headers that are not supposed to be sent.

The good news is, I used PHP curl to test it directly and I got the tokens.

Thanks very much.

Here's what I got.

That's likely the third point I warned about above -- if you request a token again you have to make sure you don't send cookies. You can uncheck them as part of the request configuration.

Thanks for your support.

1 Like