ancient-wire-79376
11/16/2023, 2:17 AMchilly-king-10285
11/16/2023, 2:17 AMchilly-king-10285
11/16/2023, 2:17 AMearliest_possible_extend
configuration. For example, if you set earliest_possible_extend
to lifespan
, sessions can be refreshed during their entire lifespan, even right after they are created. This means that as long as the user is active within the session lifespan, the session will be constantly refreshed and they won't be challenged for credentials. Here is how you can set earliest_possible_extend
to lifespan
using the Ory CLI: bash ## List all available projects ory list projects ## Get config ory get identity-config {project-id} --format yaml > identity-config.yaml
Then, update the configuration value for the property to the desired value in the identity-config.yaml
file: yaml session: cookie: domain: {project.slug}.<http://projects.oryapis.com|projects.oryapis.com> name: ory_session_{name} path: / persistent: false same_site: Lax lifespan: 72h earliest_possible_extend: lifespan
Finally, update the Ory Identities configuration using the file you worked with: bash ory update identity-config {project-id} --file identity-config.yaml
Please note that this will result in all sessions being constantly refreshed, which might not be the desired behavior in all scenarios. For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/session-management/refresh-extend-sessions).ancient-wire-79376
11/16/2023, 2:23 AMancient-wire-79376
11/16/2023, 2:24 AMchilly-king-10285
11/16/2023, 2:24 AMchilly-king-10285
11/16/2023, 2:24 AMearliest_possible_extend
in your configuration does not match the expected pattern. The pattern ^([0-9]+(ns|us|ms|s|m|h))+$
expects a numeric value followed by a time unit (ns for nanoseconds, us for microseconds, ms for milliseconds, s for seconds, m for minutes, h for hours). In the previous example, earliest_possible_extend
was set to lifespan
, which is not a valid value according to the pattern. Instead, you should set it to a specific time duration. For example, if you want to allow sessions to be extended 24 hours before they expire, you would set earliest_possible_extend
to 24h
. Here's how you can do it: bash ## List all available projects ory list projects ## Get config ory get identity-config {project-id} --format yaml > identity-config.yaml
Then, update the configuration value for the property to the desired value in the identity-config.yaml
file: yaml session: cookie: domain: {project.slug}.<http://projects.oryapis.com|projects.oryapis.com> name: ory_session_{name} path: / persistent: false same_site: Lax lifespan: 72h earliest_possible_extend: 24h
Finally, update the Ory Identities configuration using the file you worked with: bash ory update identity-config {project-id} --file identity-config.yaml
For more information, you can refer to the [Ory documentation](https://www.ory.sh/docs/kratos/session-management/refresh-extend-sessions).