You need to sign in to do that
Don't have an account?
Stephen Kennicutt
Need to handle user logout from custom Lightning component
I've got a requirement across my custom lightning applications and components to throw a javascript alert if the user has logged out during the application lifecyle (for instance, the user's session times out) and if the user attempts to perform any function in the component (e.g. click a button, load data, etc). As of Winter '18 (v 41.0), Salesforce does not rederict to the authentication page and just reports a 500 error to the console. I really need to give direction to my users and let them know that they need to log into thier Salesforce instance again.
I see that there's an application event called "aura:invalidSession", but because the event's accessibility isn't global, I can't even handle that in any of my custom components. I've tried multiple ways to trap the 500 error, but from what I can see from the console, the error is already being handled inside of the lightning production code and all I'm seeing is the result of the console.log() statement when the error is internally handled.
Are there any known ways to check to see if the user's session is still valid inside a custom lightning component? If it's not possible, this is something that REALLY needs to be implemented in the next release of Lightning for Salesforce.
Thanks!
I see that there's an application event called "aura:invalidSession", but because the event's accessibility isn't global, I can't even handle that in any of my custom components. I've tried multiple ways to trap the 500 error, but from what I can see from the console, the error is already being handled inside of the lightning production code and all I'm seeing is the result of the console.log() statement when the error is internally handled.
Are there any known ways to check to see if the user's session is still valid inside a custom lightning component? If it's not possible, this is something that REALLY needs to be implemented in the next release of Lightning for Salesforce.
Thanks!
Hope this helps.
-Rajiv
I'd thought of a similar method, but I was hoping to avoid spamming the apex server everytime a user executes a purely client side operation. Unfortuantely, it's looking like this may be the only way to handle the check for now.