stanford-oval / genie-server

The home server version of Almond
Apache License 2.0
266 stars 42 forks source link

Can not get authorization to work #316

Closed elyase closed 2 years ago

elyase commented 2 years ago

I am running Genie with:

docker run --name genie --rm -p 3000:3000 --env THINGENGINE_HOST_BASED_AUTHENTICATION=insecure stanfordoval/almond-server

After that I try a simple request:

curl --request POST --url 'http://127.0.0.1:3000/api/converse' --header 'content-type: application/json' --data '{
    "command": {
      "type":"command",
      "text":"what time is it?"
    }
  }'

But I am getting an Unauthorized response. What am I doing wrong?

gcampax commented 2 years ago

Have you completed configuration of the server? The first time the server is started (or every time if you don't use a persistent volume to store data), you need to connect with the browser and complete the configuration, regardless of the authentication setting.

elyase commented 2 years ago

I missed that, but that did it :-) . Thanks for the quick reply @gcampax .

elyase commented 2 years ago

btw is there any way to bypass the initial configuration?

gcampax commented 2 years ago

Yes create a prefs.db file in the directory used to store genie-server data containing the "server-login" information. (This directory is set with the THINGENGINE_HOME env var, it defaults to /var/lib/genie-server in the standalone container) See for example how the Home Assistant add-on does it at https://github.com/stanford-oval/almond-hassio-repository/blob/master/edge/rootfs/etc/services.d/almond/run#L11

elyase commented 2 years ago

nice! thanks for your help