Can't access backend from desktop app

I have installed Tryton on Ubuntu 22.04. However, I can’t get a connection from the desktop to the backend. The server is running in verbose mode as:

root       86609  0.3  0.5 301580 97084 pts/3    Sl   20:54   0:02 /usr/bin/python3 /usr/bin/trytond -c /etc/tryton/trytond.conf -vvvvvv

Trying to connect through the desktop gui, the table is visible; trying to login with password the server then produces the following log:

...
erkzeug.exceptions.Unauthorized: 401 Unauthorized: The server could not verify that you are authorized to access the URL requested. You either supplied the wrong credentials (e.g. a bad password), or your browser doesn't understand how to supply the credentials required.
86609 140561273456192 [2023-02-27 20:55:07,822] INFO werkzeug 127.0.0.1 - - [27/Feb/2023 20:55:07] "POST /tryton_actryx/ HTTP/1.1" 401 -
86609 140561273456192 [2023-02-27 20:55:07,826] INFO trytond.wsgi <JSONRequest 127.0.0.1 'http://localhost:8000/tryton_actryx/' [POST] common.db.login>
86609 140561273456192 [2023-02-27 20:55:07,828] DEBUG trytond.backend.postgresql.database b'SELECT COUNT(\'*\') FROM "res_user_login_attempt" AS "a" WHERE (("a"."ip_network" = \'127.0.0.1/32\') AND ("a"."create_date" >= \'2023-02-27T20:50:07.828055\'::timestamp))'
86609 140561273456192 [2023-02-27 20:55:07,833] DEBUG trytond.backend.postgresql.database b'SELECT "a"."id" AS "id", "a"."cookie" AS "cookie", "a"."create_date" AS "create_date", "a"."create_uid" AS "create_uid", "a"."login" AS "login", "a"."write_date" AS "write_date", "a"."write_uid" AS "write_uid", CAST(EXTRACT(\'EPOCH\' FROM COALESCE("a"."write_date", "a"."create_date")) AS VARCHAR) AS "_timestamp" FROM "res_user_device" AS "a" WHERE (("a"."login" = \'tryton\') AND ("a"."cookie" IS NULL)) ORDER BY "a"."id" ASC LIMIT 1'
86609 140561273456192 [2023-02-27 20:55:07,836] DEBUG trytond.backend.postgresql.database b'SELECT COUNT(\'*\') FROM "res_user_login_attempt" AS "a" WHERE ((("a"."login" = \'tryton\') AND ("a"."device_cookie" IS NULL)) AND ("a"."create_date" >= \'2023-02-27T20:50:07.835733\'::timestamp))'
86609 140561273456192 [2023-02-27 20:55:10,840] DEBUG trytond.wsgi Exception when processing <JSONRequest 127.0.0.1 'http://localhost:8000/tryton_actryx/' [POST] common.db.login>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/trytond/wsgi.py", line 117, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/usr/lib/python3/dist-packages/trytond/protocols/dispatcher.py", line 46, in rpc
    return methods.get(request.rpc_method, _dispatch)(
  File "/usr/lib/python3/dist-packages/trytond/protocols/dispatcher.py", line 61, in login
    session = security.login(
  File "/usr/lib/python3/dist-packages/trytond/security.py", line 33, in login
    user_id = User.get_login(loginname, parameters)
  File "/usr/lib/python3/dist-packages/trytond/res/user.py", line 667, in get_login
    user_ids.add(func(login, parameters))
  File "/usr/lib/python3/dist-packages/trytond/res/user.py", line 679, in _login_password
    raise LoginException('password', msg, type='password')
trytond.exceptions.LoginException: ('LoginException', ('password', 'Password for tryton', 'password'))
86609 140561273456192 [2023-02-27 20:55:10,842] INFO werkzeug 127.0.0.1 - - [27/Feb/2023 20:55:10] "POST /tryton_actryx/ HTTP/1.1" 200 -

Your help is much appreciated.

From what I can see, you do have a connection from the frontend to the backend, as the log messages are what you would expect if you are trying to login but have not provided the correct login details.

I think the problem may be that you are trying to connect as the tryton user, which wont exist if you have only just set everything up, the admin user is the one you need to start with.

So try connecting to the tryton_actryx database, with the admin user, and the password you set when you ran the trytond-admin command to initialize the database.

The ‘tryton’ role was created in psql with the right privileges: under this user the ‘trytond-admin’ script was run to initialize the database ('sudo -H -u tryton bash -c ‘trytond-admin…’). Also, I can access the tryton_actryx database directly with the dbeaver sql database browser and using the ‘tryton’ user as login, accepting the password.

The Postgres users and Tryton users are totally separate.

The trytond server connects to postgres using the user and password that you have setup, which is why you can connect to the database using dbeaver with this user.

However, when you run the trytond-admin command this initializes the database in Postgres, and creates a single Tryton user (admin). This is the user that you are setting the password for just before the trytond-admin finishes, and this is the user that you need to enter into the Tryton client.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.