ojus kulkarni ojus kulkarni - 1 year ago 804
AngularJS Question

clear cookies while logout in spring security or in angular

My trial code to remove cookies

.logoutSuccessHandler(new LogoutSuccessHandler() {
public void onLogoutSuccess(
HttpServletRequest request,
HttpServletResponse response,
Authentication a) throws IOException, ServletException {

This is code of logout security with

Here i am getting issue to delete cookies

in logger it shows cookies = 1 and i.e

So my problem is how to delete cookie at the time of logout

or if is there any another way or any way in angular then please tell me

Answer Source

After going through many blogs on spring security I got answer,

.invalidateHttpSession(true) :- it is used to clear our session
.deleteCookies("JSESSIONID") :- it is used to delete cookies

use this after your success handler so that it will remove all cookies after logout