2👍
For anyone that is struggling with the same issue, I have found the solution.
The problem was that the default for xsrfHeaderName in axios does not match the value that the django backend is looking for. So the csrftoken from the cookie is not sent in the HTTP headers.
To fix it, you need to create a plugin that looks like this:-
export default function ({ $axios }) {
$axios.defaults.xsrfHeaderName = 'X-CSRFTOKEN'
$axios.defaults.xsrfCookieName = 'csrftoken'
}
and add it in to the plugins section of the nuxt.config.js:-
'~/plugins/axios',
Source:stackexchange.com