incalculable-petabyte-84501
03/07/2025, 7:20 AMbrief-egg-61061
03/07/2025, 7:20 AMbrief-egg-61061
03/07/2025, 7:20 AM/sessions/whoami
endpoint as described in the [Ory API Reference](https://www.ory.sh/docs/reference/api). 2. To properly logout and invalidate a session, you can use the /self-service/logout/browser
endpoint for browser-based flows or the /sessions
endpoint for API-based flows, as detailed in the [Ory API Reference](https://www.ory.sh/docs/reference/api). 3. For settings flows specifically, Ory has a built-in mechanism to handle expired sessions. As mentioned in the [Ory Kratos User Settings & Profile Management Documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-settings): "If the Ory Session is older than the specified amount, the user is prompted to re-authenticate similar to the GitHub sudo mode." This means that for browser-based flows, Ory will automatically redirect the user to re-authenticate if the session has expired during a settings update attempt. For API-based flows, you'll receive a 403 Forbidden status, at which point you should initiate a new login flow as described in the [API-based Login Flow documentation](https://www.ory.sh/docs/kratos/self-service/flows/user-login). Remember, it's crucial to handle session expiration securely on both client and server sides to maintain proper security in your application.