Mealie: Logged out after two days? How to extend session duration and reduce re-logins

πŸ”„ Updated:

πŸ—“οΈ Posted:

🏷️ Category:

,

⏱️ Reading time:

2–3 minutes

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.

×
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on https://www.amazon.com/ at the time of purchase will apply to the purchase of this product.

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.

$139.99
As of: January 28, 2026 8:01 PMDetails
×
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on https://www.amazon.com/ at the time of purchase will apply to the purchase of this product.

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_TIMEdefault:
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:

  1. Mealie Backend Configuration – API Environment Variables β†©οΈŽ

Cover image created with AI assistance (chatGPT, OpenAI)

Comments

2 responses to “Mealie: Logged out after two days? How to extend session duration and reduce re-logins”

  1. Duncan de Jong

    Thank you. Exactly at the right time!!!

    1. Thing King

      Thanks for your comment – happy to help πŸ™‚

Leave a Reply

Your email address will not be published. Required fields are marked *

WordPress Cookie Notice by Real Cookie Banner