Token mismatch between 'springboot' and React AXIOS CSRF communication

69 Views Asked by At
return  http.csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse())
                    .and()
                    //.authorizeRequests().antMatchers(HttpMethod.OPTIONS, "**").permitAll()    
                    //.and()
                    .build();

Spring Security

xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',

axios default setting

I configured springboot as above and got the CSRF token from spring with GET and put it in the header to communicate with AXIOS, but the token is not correct.

How do I fix it?

The return should be OK, but I get a 403 forbidden error

0

There are 0 best solutions below