<@U04UQ68083H> how to configure session token life...
# ory-copilot
b
@chilly-king-10285 how to configure session token lifetime expiration in kratos selfservice login ?
b
A message from kapa.ai
To configure the session token (session) lifetime expiration in Ory Kratos self-service login, you need to set the session lifespan. This determines how long a session remains valid after a user logs in. When the session lifespan expires, the user must re-authenticate. You can configure the session lifespan in two main ways: ### 1. Using Ory Console - Go to the [Ory Console](https://console.ory.sh/). - Navigate to Session Settings. - Enter your desired session lifespan (e.g.,
720h
for 30 days,
1h
for 1 hour) and save. ### 2. Using Configuration File Download your Ory Identities config, then set the
session.lifespan
property:
Copy code
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:
Copy code
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).