Note that there are some explanatory texts on larger screens.

plurals
  1. POServer-side timeout issues with Devise
    primarykey
    data
    text
    <p>I am currently building a rails app, using the devise gem for authentication.</p> <p>Currently in the app there is only client-side timeout functionality implemented, which I don't feel is a good final solution. Because it doesn't cover the case when a user puts their computer to sleep just for 1 example.</p> <p>So I wanted to implement the timeout module in devise, however there are several issues I am facing. The issues are because with server-side timeout the user needs to navigate to a different page before they are redirected to the sign in page. And there are a lot of interactions in my app when a user will open a modal in the UI, which will trigger an AJAX call (which will fail if they have been timed out on the server-side).</p> <p>Here are 2 approaches I have thought of, but I don't see them as good solutions so maybe someone can build on one of these approaches or help point me in a different direction:</p> <p>1.) In my AJAX requests, add a handler inside the 'error' callback that will tell the user to refresh the page or go to the login page if the error callback returns a 401 Unauthorized response.</p> <p>Cons: There are a lot of these ajax requests in the app, so there would be a lot of repetitive code and I see this as being difficult to maintain.</p> <p>2.) Add a click handler to the body and every time it is triggered, send a request to the backend to validate if the user is still logged in. If they aren't redirect the user to the login page.</p> <p>Cons: Performance issues</p> <p>Any advice would be appreciated. Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload