If a user clicks remember me when logging in the logout function will not work, it will not kill the cookie. The logout function works fine if the remember me box has not been ticked.
I have a feeling that this is going to be something really sill. Any help appreciated?
The run steps in the flow don't wait for the previous one to complete, they run at the same time. This means the redirect step can run before the step that runs the server action.
To fix this you need to run the logout server action and then run the redirect event after it's finished.
Which means - remove the flow from the button. Add a click dynamic event and call the server action directly on click (without a flow).
Then select the logout server action, add a dynamic event > success > and call the browser redirect there.
What the remember me option does is to set a cookie.
If you don't use the remember me option, the login does not create a cookie and is valid only for the session.
Thanks I appreciate that but it misses the point that if I login without ticking the remember me box I can log out fine. But the logout process fails if I log in and do tick the remember me box. The logout function is not clearing the remember me cookie.
You must be doing something wrong, as it works just fine in my tests.
Can you verify in the dev tools under network > XHR that the logout action actually runs and returns status 200, when you click the button?
Also how exactly do you verify if you are logged in or not?
I am sure that I am doing something wrong. So I am starting again and no matter how many times I delete the Security Provider it keeps coming back when I restart Wappler and I have checked that the file doesn’t exist on the server or locally.