successible / cleanslate

☀️ Track food without judgment
https://cleanslate.sh
Apache License 2.0
70 stars 7 forks source link

Cannot login with apiToken #176

Open defyingphysics opened 6 hours ago

defyingphysics commented 6 hours ago

Hey,

I have managed to get the app hosted locally on a Raspberry Pi by setting up the NEXT_PUBLIC_HASURA_DOMAIN and the domain in the caddy file to my reserved RPI IP e.g. https://192.168.0.4:4000.

I managed to login to the Hasura Console and made a new user in profiles. When I try to use apiToken at 192.168.0.4:4000, I get the error "No matching profile found! Make sure to login with apiToken, not authId."

I checked the docker postgres container running on the PI and the user I created is indeed in the profiles table.

I am out of ideas as I have now followed steps 5 and 6 from the hosting instructions a few times with no success.

Here are the docker containers running on my RPI.

cleanslate-authentication-server "docker-entrypoint.s…" 20 minutes ago Up 20 minutes 0.0.0.0:3001->3001/tcp, :::3001->3001/tcp authentication-server cleanslate-client "busybox httpd -f -v…" 20 minutes ago Up 20 minutes 0.0.0.0:3000->3000/tcp, :::3000->3000/tcp client hasura/graphql-engine:latest.cli-migrations-v3 "docker-entrypoint.s…" 20 minutes ago Up 20 minutes (healthy) 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp graphql-server postgres:15 "docker-entrypoint.s…" 20 minutes ago Up 20 minutes (healthy) 5432/tcp database

paulzakin commented 5 hours ago

Unfortunately, that error is not really an error. It is just saying that the apiToken for the profile does not match the one you passed in on the login screen. Are you sure you are using apiToken, not authId? And you are sure you are passing the value shown in the console?

Also, that port seems a bit odd. Almost everyone who runs the app does so on :443 like a standard https://example.com sort of thing. Perhaps that is the problem? I have never tested having the proxy for the app on a non-standard port like that. Perhaps switching to a different proxy (like nginx) or serving it at :443 will help. For example, even when testing locally, I run it at https://localhost.

Beyond that, the check is just returning nothing for this GraphQL request. So if this query works in the Hasura Console ($token is a variable) it might a problem with some other part of your setup. My instinct says it is the proxy.

query GET_PROFILES($token: uuid!) { profiles( where: { _or: [{ apiToken: { _eq: $token } }] } ) { authId id } }

Beyond that, my ability to debug here is pretty limited :( Every self hosting set up is quite different, no one else has reported this error, and I cannot replicate this locally. I am sorry I cannot be of more help. If you cannot get it to work, you can of course always use the instance we host (app.cleanslate.sh), but totally understand if that is not an option