I have a Java application developed with Spring Boot which is the back-end. The front-end is an application developed in ReactJs. I use REST services. I use axios for REST calls. I recently enabled the security in Spring Boot. Now I have difficulty to authenticate axios calls.
var config = {
auth: {
username: 'bruker',
password: 'passord'
}
};
axios.get('http://localhost:8090/employee/all', config).then(function (response) {
console.log(response)
}.bind(this)).catch(function (response) {
console.log(response)
}.bind(this))
I get the following error "Response for preflight is invalid (redirect)"
I assume the response is a redirected to localhost:8090/login
I haven't found any solutions to this. What do I do wrong?