score:3

Accepted answer

its not a good idea to remove or change the session from the javascript, because "Play Framework uses stateless sessions". There is no state stored on the server side, rather, all the state is stored in the session cookie. To validate a session, Play signs the sessions using a secret key, and validates the signature when a request with a session cookie arrives. If cookie was modified from the javascirpt, then the signature would not match, and so Play would reject the session cookie.

so its better that you change it from your server side.

in scala

Ok("Bye").withNewSession

in java

session().clear();

Related Query

More Query from same tag