Skip to main content

On trying to set session timeout for a Community User using the Profile settings to logout user from the Community site once the session is timed out and redirect them to a custom page. It is working properly on the Salesforce org level but doesn't work for the LWR Community site. Here the session is getting invalidated but the user isn't redirected automatically to the custom page. Only on manual interventions or page reload the user is being redirected directly to the Login page instead of the custom page. Is there any workaround or OOTB solution to this issue?

1 answer
  1. Apr 23, 2024, 4:08 PM

    @Ataurrehman Shaikh

    The behavior you're experiencing might be due to differences in session handling between standard Salesforce UI and Lightning Web Runtime (LWR) Communities. In LWR Communities, there could be limitations or differences in how session timeout is handled compared to standard Salesforce UI.

    Here are some potential workarounds or solutions you can consider:

    1. Use JavaScript: You can implement a JavaScript solution to detect when the session has timed out and then redirect the user to the custom page. This could involve periodically checking the session expiration time and redirecting the user when it's reached. However, be mindful of performance considerations and limitations with client-side scripting.
    2. Handle in Custom Component: If you're using custom components within your LWR Community, you can handle session timeout logic within the component itself. This would involve using JavaScript to detect session expiration and then triggering the redirect to the custom page. Make sure to consider the security implications of handling session-related logic on the client side.
    3. Server-Side Logic: Depending on your specific use case, you might be able to implement server-side logic to handle session timeout and redirection. This could involve using Apex triggers, controllers, or server-side JavaScript (Node.js) to monitor session expiration and perform the necessary actions.
    4. Check Community Settings: Review the settings and configurations of your LWR Community to ensure that session timeout settings are properly configured. There might be specific Community settings or configurations related to session handling that need adjustment.
    5. Salesforce Support: If you're unable to find a suitable solution or workaround, consider reaching out to Salesforce support for assistance. They may be able to provide insights or guidance on how to achieve the desired behavior within LWR Communities.

    Ultimately, the best approach will depend on your specific requirements, technical constraints, and familiarity with Salesforce development tools and techniques. Make sure to thoroughly test any solution to ensure it meets your needs and complies with security best practices.

     

    Thanks

    A. Gobinath.