Mattermost Desktop: session expired

I don’t know how to identify them, it was just an assumption that maybe one of the sessions is corrupt and I wanted to find out if the problem gets fixed when you clear your user’s sessions manually using the GUI and if there are any sessions left.

You can export the sessions in your database first by running the following query:

select * from sessions where userid IN (SELECT id FROM users where username='YOURNAME');

The values for the column expiresat would be interesting, they should contain a unix timestamp which should be resonably higher than the createat timestamp.

mattermost=# SELECT TO_TIMESTAMP(createat/1000),TO_TIMESTAMP(expiresat/1000) from sessions where userid IN (SELECT id FROM users where username='YOURNAME');
      to_timestamp      |      to_timestamp
------------------------+------------------------
 2022-10-27 07:31:15+02 | 2022-12-16 10:43:01+01
 2022-12-08 17:26:13+01 | 2022-12-27 05:41:46+01
 2022-12-02 14:47:11+01 | 2022-12-21 07:41:45+01
 2022-08-24 16:52:03+02 | 2022-12-27 09:08:06+01
(4 rows)

There are several settings in the system console and config.json that have an impact on the session duration, here’s an example out of my config.json:

# grep SessionLength /opt/mattermost/config/config.json
        "ExtendSessionLengthWithActivity": true,
        "SessionLengthWebInDays": 14,
        "SessionLengthWebInHours": 336,
        "SessionLengthMobileInDays": 14,
        "SessionLengthMobileInHours": 336,
        "SessionLengthSSOInDays": 14,
        "SessionLengthSSOInHours": 336,

The values here mean that I do have 14d session length, so users would have to re-login after 14 days and additionally, I do extend the session expiration when there’s activity on the account (ExtendSessionLengthWithActivity).

What do these values look like on your system?