Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Dynamic Portal - Idle session timeout and session timeout implementation

  • 1.  Dynamic Portal - Idle session timeout and session timeout implementation

    Posted 29 days ago
    Edited by Jimmy mcad 29 days ago

    Dear experts,

    When a user visit the portal, His activity timer starts. It will end in 60 mins for example overall.
    1. My requirement is, simply implement a warning message, if user is not doing anything or idle during that time for 1200 secs.
        1a) After showing the message, if he still does not do anything log him out in 60 secs.
    2. And then log his session out, in overall after 60 mins.
    3. Show the counter hh:mm:ss at the top somewhere which should be global for every page he clicks.
     

    Now, can you guide me, how can I using jquery with power app portals + dynamic 365 to achieve all above.
       1. I need to configure the portal for session timeout.  How do i do that in portal?
       2. Can i get the session timeout from portal config  and display that on portal web page?
       3. Just using jquery as solution, i am struggling to keep the same timer on all pages which runs for 60 mins. How do i do that?
       4. Also, can I achieve this, by not actually signing on the portal. A user is doing it without signing on portal. I have my APIs to display data on portal

    Please if you can answer as possible. Many thanks in advance

    Kind regards,



    ------------------------------
    Jimmy mcad

    ------------------------------
    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


  • 2.  RE: Dynamic Portal - Idle session timeout and session timeout implementation

    MICROSOFT MVP
    Posted 24 days ago
    Hi Jimmy,

    You can configure the session timeout using the Authentication/ApplicationCookie/ExpireTimeSpan and Authentication/ApplicationCookie/SlidingExpiration site settings (see https://docs.microsoft.com/en-us/powerapps/maker/portals/configure/set-authentication-identity for more info).

    I don't know how in JavaScript you can get the amount of time left before the session times out, so if I needed to implement what you've described, I'd "fake" it by storing the login time using browser local storage (https://www.w3schools.com/html/html5_webstorage.asp). You can do this by using a combination of Liquid (which checks if the user is authenticated), and JavaScript, which would set the variable if the user is logged in and the variable doesn't exist, or removes the variable if the user is anonymous. This will be accessible across all pages. Then you can calculate how long its been since that time, and once it passes 60 minutes, redirect the user to the logout page.

    I'm not sure what you mean by #4 - if users aren't signed into the portal, what timeout would be necessary?


    ------------------------------
    Nicholas Hayduk
    Engineered Code Consulting Inc.
    Regina SK
    ------------------------------

    The first step toward cloud success. - Migrate from CRM to D365 with expert guidance from Microsoft. I'm Ready


If you've found this thread useful, dive deeper into User Group community content by role