vendredi 4 mars 2016

Laravel pages with multiple ajax calls sometimes logs a user out

I have build a CMS where pages are build with elements. Each element has fields etc. When editing a page all elements (with their corresponding fields) are put in an accordion. When clicked on a accordion title, it opens the element (with fields and values). Data is retrieved using Ajax. When the user edits the fields, he clicks on save, which triggers another Ajax call.

The thing me and clients are noticing, is that if you work fast (like opening one element, whoops wrong one, lemme open another etc), the user gets logged out. An error 403 is sent saying 'Unauthorized'

At first thought this had to do with the CSRF tokens. Sent it as a _token field or in the headers with the Ajax calls etc. When this was not working I decided to make a token exception for all Ajax calls, but still the same problems.

It looks like, when one ajax request is still being processed and I call another, I get logged out.

So my question is, what to do about this? As it's very annoying for the 'fast' users among us.



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1QRQMwF
via IFTTT

Aucun commentaire:

Enregistrer un commentaire