Mario-35 / Stean

SensorThings Enhanced API Node
MIT License
0 stars 0 forks source link

login returns 401 error for new instance just created #2

Open hsquividant opened 1 month ago

hsquividant commented 1 month ago

After creating a new instance, @t-loree can't connect with the login/passwd he just created. The api returns a 401 error: '{“code”:401, “message”: “Unauthorized”}'. When I look at the postgres console, the database owner is postgres and not the postgres user I've just created, but maybe that's normal? pm2 logs only returns : [[39m 28/10/2024 10:34:53 <-- POST /tom_2810/v1.1/login [[39m 28/10/2024 10:34:53 xxx POST /tom_2810/v1.1/login 401 1ms - Any idea ?

Mario-35 commented 1 month ago

the bug has already been fixed it is no longer possible to create a postgres user which has depending on its rights the possibility of changing the original postgres password. The solution is to create a service by logging in with the new password "accidentally" saved. In the creation of the service put the password leaving the postgres user. Finally make an update to prevent this from happening again. image

t-loree commented 1 month ago

For more information this is what i did:

Capture d’écran du 2024-10-29 09-34-25

Capture d’écran du 2024-10-29 09-35-58

When i try to logging with :

data={
    "username": "test2910",
    "password": "My new password"
}

i have : {"code":401,"message":"Unauthorized"}

By the way, if you put two different password for "New user password" and "repeat password", there is no warning and the new service is created.

Mario-35 commented 3 weeks ago

I am not be able to reproduce it, but I rewrite the service code and I test in few different use case, let me know if it's better ...

You have to update 0.9.4

hsquividant commented 3 weeks ago

I've just updated to 0.9.4, @t-loree, can you test again ?