Thank You. It worked.
httpSecurity.csrf() .csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());