If you self-host Mealie, you know the problem: You open the recipe management software because you want to cook something β and you’re greeted with the login screen. You have to enter your username and password again, even though you feel like you logged in just recently. By default, Mealie automatically logs you out every two days, which can quickly become annoying in everyday use.
Notice:
This is a translation of the German article. Please note that especially menu names, button labels, names, screenshots etc. might not be translated (correctly). Feel free to let us know in the comments if you notice any errors.
In This Article
Why Does This Happen?
When you log in, your browser receives an authentication token. This token is only valid for a limited time. When it expires, you are automatically logged out and must log in again.
The duration for which a session remains active without re-login is called session length or token lifetime. With Mealie, you can easily adjust this via a configuration variable.
In this article, we show you how you can set Mealie’s session length yourself.
Requirement: You run Mealie via Docker (e.g., with
docker-compose).
β Perfect for conveniently displaying Mealie recipes on a tablet in the kitchen.
Why Should You Increase the Token Lifetime?
Mealie generally does not contain highly sensitive data, but “only” recipes and shopping lists. Additionally, it is often operated in a private, domestic environment.
In such scenarios, for many users the convenience gain from a longer session duration outweighs the purely theoretical, minimally increased security risk. After all, you don’t want to have to log in again constantly while cooking.
The Solution: Increase TOKEN_TIME
Mealie provides a suitable environment variable for this. In the official documentation1, you can find the following:
| TOKEN_TIME | default: 48 | The time in hours that a login/auth token is valid. Must be <= 9600 (400 days, in hours). |
The relevant parameter is called TOKEN_TIME and is specified in hours. If you want to log in only every 30 days instead of every two days, that corresponds to 720 hours.
Add the parameter to your docker-compose.yml in the environment section, for example like this:
services:
mealie:
image: ghcr.io/mealie-recipes/mealie:latest
...
environment:
# Set backend ENV variables here
ALLOW_SIGNUP: false
TOKEN_TIME: 720 # defines how long the authentication token is valid (in hours)
PUID: 1026 # enter the UID of the user who created the folder on the host system for the bind mount
PGID: 100 # enter the GID of the user who created the folder on the host system for the bind mount
...Source: https://docs.mealie.io/documentation/getting-started/installation/sqlite/ [adapted for Synology DiskStation]Then you need to restart the Mealie Docker container and log back in once in the Mealie web interface.
From now on, your session will remain active for the specified duration β in this example, a full 30 days. π½οΈπ
Sources and further information
We also have a guide on how you can install Mealie on a Synology DiskStation:
Cover image created with AI assistance (chatGPT, OpenAI)

Deutsch
Leave a Reply