I am working on an application using React+Redux and using axios
to make api calls.
Here's a sample call which fails:
axios.post(`${API_ROOT}${FIND_USER}${currentUserID}`, {
headers: {
'Authorization': token
},
})
.then((response) => {
console.log("Sucess")
})
Request url when I see in network
is something like:
http://domainName:8080/users/findUser/1234
API call fails at OPTIONS
itself and error I am receiving from backend is
Response for preflight has invalid HTTP status code 403
It never reaches POST
.
token
is retrieved from localstorage
and is something like Bearer eyJhbGci...
.
Backend developers are using Java and Spring .
Is there something wrong in the way I am calling the APIs or this problem should be resolved in the Backend?
This API works totally fine when tested through Postman.