Session timeout for Metabase

What is the session timeout period for metabase?

Hi @rbhatnagar
The sessions timeout is set to 14 days.

How can I edit the session timeout?

@c_schmitz
You can define the environment variable MAX_SESSION_AGE in minutes.
By default, it’s 2 weeks = 20160 minutes

1 Like

Thank you.
Since I am running the .jar file directly I would just set this as a system environment variable in Linux?

Correct, just like the variables for whatever backend database you’re using:
https://metabase.com/docs/latest/operations-guide/start.html#configuring-the-metabase-application-database

What would be the way to do that when using Metabase on AWS (Beanstalk), using the official importer?

Is there a way to configure a session timeout for a particular session? Because changing the env var will change it for all sessions, not just one.

I’d like to create a session of 1-3 years for a very particular session, used by a third party service where I can’t refresh the token automatically.

@Vadorequest-sl
Hmmm, I’m not sure if that’s possible. You could create your own middle-layer, so the service contacts your layer, which either gives an existing token or creates a new token, when needed.

Yeah, it doesn’t look possible from the docs, but that’s what I was trying to avoid (building a dedicated service just to handle auth)

Does 0 (-1?) value of MAX_SESSION_AGE make the session last inifinitely?

@buckelieg No, you would have to set it to a very high number. Or use MB_SESSION_COOKIES=true