Ricevo un errore CSRF grave anche dopo aver impostato chiavi API e nomi utente nelle mie intestazioni

Sto cercando di effettuare una richiesta POST e ho impostato gli header e il contenuto, ma non ottengo il risultato giusto:

export default async function postNewTopic(req, res) {

    axios.post(`url/posts.json?title="${req.query.title}"&raw=${req.query.content}&category=1`, {

    headers: {

      "Api-Key":  token ,

      "Api-Username": {My key}

    }})

    .then(function (response) {

      res.json(response.data);

    })

    .catch(function (error) {

      const err = error?.response?.data || error;

      res.status(error.status ||  error.statusCode || +error.code || 500).json(err)

    })

}

Ed ecco il mio codice frontend:

const createTopic = () => {

    axios.post(`api/post-new?title=${title}&raw=${content}&category=1`, {

        headers: {

          "Authorization": 'Bearer' + "",

          "Api-Key":  token ,

          "Api-Username": ""

        }})

    .then(function (response) {

      res.json(response.data);

    })

    .catch(function (error) {

      const err = error?.response?.data || error;

      console.log(error.response.data)

    })

  }

La tua chiave API dovrebbe essere la chiave API e il nome utente dovrebbe essere il nome utente. Sembra che tu stia inviando la chiave API come nome utente?

No, no è solo nell’esempio che ho cancellato. Ma ho inserito la chiave API e il nome utente API, le funzioni get funzionano