I'm having a tricky issue with session cookies in the android version of our cordova app. During usage the app and its session cookies work fine; however, if the user force-closes the app (in android, swiping away from the task switcher, for example,) then the next time the app is started the user is logged out.
This issue doesn't occur on the ios version of our app. This suggests to me that it has to do with the chrome webview, or the cordova android plugin.
Debugging on the server suggests that the laravel_session
cookie is not sent with to the server the first API request, though it is set properly from the server and is sent with each subsequent request. (I added logging to the middleware that prints the $_SESSION
variable.)
If I visit the API url using chrome on my laptop, it appears to be setting the cookie properly with an expiry time of one day (please ignore the json response; it's okay that this browser isn't authenticated):
If I make the same request from within my cordova android app, it only shows provisional headers:
The server is running laravel 5.6 using redis for sessions. The app is build with cordova 7.1.0 and cordova-android 6.3.0.
I have trouble debugging at this point because it happens on startup and b the time I can inspect the device it's already gone ahead.
tl;dr: the app doesn't stay logged in after it's closed, and I suspect it has something to do with the laravel_session
cookie not being present when the app first checks to see if it's logged in.
How do I resolve this?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2N4jJv8
via IFTTT
Aucun commentaire:
Enregistrer un commentaire