I am trying to run the anvil-app-server locally using the online anvil editor for all the coding. So far this has been a great experience!
As I am testing numerous components of anvil I seem to run into a bit of an issue with the user login sessions.
I created a working example where I can login and the session persists running this on anvil.works as expected. The most simple test I perform is doing a page refresh. As stated this is working fine on anvil.works.
When I run the same code on our local anvil app server this no longer works, user sessions are no longer persistent. Doing a page refresh seems to create a new session no longer keeps the current user session.
Is this expected bahaviour when using the local app server?
Clone link below:
[anvil-app-server] browser sessions - fix
- Make sure the anvil app server is running with https enabled as the session cookies are sent from the server with secure attribute enabled. This means they will be denied by the browser otherwise.
- Make sure you are using a valid certificate or in case of self signed that it is trusted on the client.
[anvil-app-server] remember login between sessions - not fixed
It seems for this to work the browser needs to send a request to the server which then replies with a special anvil-app cookie. However the request to the server is denied hence no cookie is returned hence login between sessions is not working. It appears the initial request is denied by the server because of “Invalid anti-forgery token”?
Both of these issues should now be fixed, in App Server v1.7.0
Very nice, I will check it!
For the record successfully tested using anvil-app-server 1.7.3!
Thank you for the update!