Authenticated POST request returning 403 (axios)

As we talked in the thread, this might be an issue while using axios.post method.

According to docs axios.post(url[, data[, config]]) has 3 parameters, you are only sending 2.

The possible possible solution might be:

const {data} = await axios
  .post('http://localhost:1337/crypto-accounts',  {
      username: `${user}`,
      password: `${pass}`,
    },
   {
    headers: {
      Authorization: `Bearer ${response.data.jwt}`
    }
  });
console.log(data);
2 Likes