priyank-purohit/PostGUI

Authentication jwt and PostGUI

bmgante opened this issue · 2 comments

Hi all,

I am trying to setup a PostGUI (https://github.com/priyank-purohit/PostGUI) which makes use of postgrest but getting struggled with jwt authentication.

Does anyone here has some kind of experience with this app? I did the config as mentioned in POSTGUI read me but when i click on login button nothing happens... at postgrest logs i can see that the post /rpc/login succeeds but at postgui application level nothing happens (and there are no logs!).

Example of a manual post to /rpc/login:

TRUT10236:network-catalog-ui-api bruno.gante$ curl -X 'POST' 'http://127.0.0.1:3000/rpc/login' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"email": "admin@domain.com", "pass": "CHNAGME123"}'
{"token":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiZWRpdHVzZXIiLCJlbWFpbCI6ImFkbWluQGRvbWFpbi5jb20iLCJleHAiOjE2NjIxMjMwNjd9.INmxG3p0k5rFvOqfzh0pqsNmUGw6TYaZvJPAWTXeT3o"}
Example of postgrest log when i try to login in PostGUI with valid credentials:

172.18.0.1 - - [02/Sep/2022:11:38:53 +0000] "POST /rpc/login HTTP/1.1" 200 - "http://localhost:8771/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"

Example of postgrest log when i try to login in PostGUI with invalid credentials:

172.18.0.1 - - [02/Sep/2022:11:59:22 +0000] "POST /rpc/login HTTP/1.1" 403 - "http://localhost:8771/" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36"

Is there someone here that could help please? @priyank-purohit @erjanmx

Thanks

image
image

Fixed the problem. There is an issue on master branch
Auth.js line 84: change from "let data = rawResp.data[0];" to "let data = rawResp.data;"

I am now facing another issue when selecting rows from table to delete.
DataTable.js line 594: let changedRowPkStr = primaryKey.join(""); ---> primaryKey here is a string and join function is only applicable to arrays. Do not really now how to address this yes, any idea?