InvalidRequestException: You must be authenticated in order to use this resource

Hello,

I would like to check the authorisations for the user demo using the REST API from my application. I tried the GET request bellow but I get the error InvalidRequestException.

http://localhost:8080/engine-rest/authorization/check?permissionName=READ&resourceName=User&resourceType=1&resourceId=demo&demo=demo

Thank you.

Hi @camunda-test,
do you have a stackstrace and/or exception message? It can be either in REST response or in Camunda log.

Also this part of the query looks like incorrect to me: demo=demo

The demo=demo is added for the authentication. I don’t think that it causes a problem, because I have the same in other requests and they work fine.

I couldn’t find any addition logs. The only message I have is “You must be authenticated in order to use this resource”

But you indeed must be authenticated to make such request. And adding demo=demo would not authenticate you. Taking into account, that the other requests are working for you, I would suppose, that you forgot to configure authentication. Could you please check this docs and try to switch on HTTP Basic Authentication?

You are completely right I haven’t turned on the HTTP authentication because I didn’t have to authentify for the previous calls.
I read the link you send me, but I don’t understand how I can turn on the HTTP authentication because I’m using a Docker image of camunda and the REST API.

I just tried it and it’s actually easy:

  1. exec bash on the docker container: docker exec -it camunda bash
  2. cd webapps/engine-rest/WEB-INF
  3. edit web.xml as described in docs
  4. run docker restart camunda

Thank you for the answer. It works well. But just to confirm there is no other way, except manually modifying the web.xml file ? I cannot turn it on using the REST API or in the browser(using the web app for camunda) ?

No, I’m afraid not.