best-plumber-65600
06/30/2025, 9:23 AMbrief-egg-61061
06/30/2025, 9:23 AMbrief-egg-61061
06/30/2025, 9:23 AM720h
for 30 days, 1h
for 1 hour) and save. ### 2. Using Configuration File Download your Ory Identities config, then set the session.lifespan
property: yaml session: cookie: domain: $<http://PROJECT_SLUG.projects.oryapis.com|PROJECT_SLUG.projects.oryapis.com> name: ory_session_{name} path: / persistent: false same_site: Lax lifespan: 720h # Set your desired session lifespan here (e.g., 720h for 30 days)
After editing, update your project configuration: sh ory update identity-config --project <project-id> --workspace <workspace-id> --file identity-config.yaml
Note: The session cookie's max-age
will, by default, match the session lifespan unless you change the persistent
setting. If you want a different cookie expiration, set session/cookie/persistent
to false
and adjust accordingly. For more details, see the official documentation on [session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan) and [session management](https://www.ory.sh/docs/kratos/session-management/overview) in Ory Kratos [Session lifespan](https://www.ory.sh/docs/kratos/session-management/session-lifespan).