You can disable csrf - httpSecurity.csrf().disable();
@Configuration
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity httpSecurity) throws Exception {
...
httpSecurity.csrf().disable();
...
}
}