will help you Spring Security CSRF Documentation You need to include the token in your requests. If you use Thymeleaf as your templating engine, this is handled automatically. The documentation also describes how to handle Ajax as well.
I hope this helps you . Following code solved the problem. The last line with httpBasic() function removal did the trick. everyone.
.antMatchers("/index.html", "/home.html", "/login.html", "/").permitAll()
//Add this line to remove Authentication through browser problem
What is the reason to disable csrf in spring boot web application?