Deleting a record form my webapp results in a 401 error.
I tried:
axios.delete(`../api/cards/${id}`,{headers:{Authorization:'Bearer '+this.token, 'Content-Type':'application/json', 'Access-Control-Allow-Origin':'*'}})
as well as
const formData = new FormData();
formData.append('_method', 'DELETE'); // axios setting
const config = {
headers: { Authorization: `Bearer ${this.token}` }
};
axios.post(`../api/cards/${id}`,
formData,
config
)
result is:
Request URL: http://localhost:8000/api/cards/21
Request Method: DELETE
Status Code: 401 Unauthorized
Remote Address: 127.0.0.1:8000
Referrer Policy: strict-origin-when-cross-origin
When I use Postman with the token taken from the chrome dev Application Local storage it works like a charm.
I have no clue where to start debugging this. Any suggestions that could lead to a solution?