conquery icon indicating copy to clipboard operation
conquery copied to clipboard

Unauthorized Error (Trying to set up a demo system)

Open jeromerg opened this issue 2 years ago • 1 comments

Hi together,

I am trying to set up a demo environment. I compiled and started both backend and frontend locally, then executed the demo python notebook to fetch, transform and upload the data to the backend. Everything works fine. In the Admin UI, I can see the dataset. But when I open the UI, it intends to fetch some information from the backend, including the list of datasets, but the server replies with a 401 (Unauthorized) Status Code.

Can you explain shortly how to set up a user account with valid credentials, so that I can further test the software?

Thank you in advanced! Kind Regards

jeromerg avatar Jul 26 '22 14:07 jeromerg

I have the same issue

Flou21 avatar Jul 20 '23 10:07 Flou21

Hey,

tldr; open the frontend with http://localhost:8000?access_token=user.SUPERUSER

the default configuration uses the DevelopmentAuthorizationConfig with a superuser configured and the FirstInitialUserRealm.
The latter simply tries to extract a user id from the authorization header of a request and looks up the user.
If no user was found, the acces is denied. When no header was given, simply the first configured user is assumed for the request.

The frontend always sends an authorization header, even if it is empty (like Authorization: Bearer ). You can fill the missing part by opening the frontend with the access_token query parameter set: http://localhost:8000?access_token=user.SUPERUSER. Then all frontend request will have the header set like this: Authorization: Bearer user.SUPERUSER.

The DevelopmentAuthorizationConfig recently changed the superuser id. It was user.SUPERUSER@SUPERUSER before. I'll look into the notebook if the change was propaged there.

thoniTUB avatar Apr 25 '24 07:04 thoniTUB

I checked the notebook.

The last cell contains the correct user id and intructions for the frontend.

thoniTUB avatar Apr 25 '24 07:04 thoniTUB