-
Local deployment, it seems auto log out very soon when user has no behavior, how to set config that can auto log out for couple of days by default. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
To adjust the auto‑logout (idle session expiration) in LibreChat, you can configure two environment variables:
By default:
1. Using Docker ComposeIf you’re deploying with Docker Compose, update your service definition for services:
api:
# ... other settings ...
env_file:
- .env # or define environment inline
environment:
# Session cookie valid for 2 days
- SESSION_EXPIRY=172800000
# Refresh token valid for 14 days
- REFRESH_TOKEN_EXPIRY=1209600000 Then create or update a # Session cookie valid for 2 days (2*24*60*60*1000)
SESSION_EXPIRY=172800000
# Refresh token valid for 14 days (14*24*60*60*1000)
REFRESH_TOKEN_EXPIRY=1209600000 After saving, restart your stack: docker compose down
docker compose up -d Your sessions will now remain active for up to 2 days of inactivity (until the cookie expires), and refresh tokens for 14 days. 2. Using NPM / Local DevelopmentIf you’re running LibreChat locally via NPM:
3. Handling Secure Cookies (HTTP vs HTTPS)In production mode, LibreChat issues
For details on this behavior, see the Automatic Logout discussion: [#3001] ([github.com](#3001)) 4. ReferenceDetailed documentation on session and token expiration can be found in the official LibreChat docs:
https://www.librechat.ai/docs/configuration/authentication#session-expiry-and-refresh-token (librechat.ai) |
Beta Was this translation helpful? Give feedback.
To adjust the auto‑logout (idle session expiration) in LibreChat, you can configure two environment variables:
SESSION_EXPIRY
: how long the session cookie remains valid (in milliseconds).REFRESH_TOKEN_EXPIRY
: how long the refresh token remains valid (in milliseconds).By default:
SESSION_EXPIRY = 1000 * 60 * 15
(15 minutes →900000
)REFRESH_TOKEN_EXPIRY = (1000 * 60 * 60 * 24) * 7
(7 days →604800000
)1. Using Docker Compose
If you’re deploying with Docker Compose, update your service definition for
api
in yourdocker-compose.yml
(or supply a separate.env
file):