[Vuejs]-Laravel returns 419 csrf token mismatch after vue axios request

0👍

Use this code in the page header:

<meta name="csrf-token" id="token" content="{{ csrf_token() }}">

inside the script tag add:

window.Laravel = {csrfToken: '{{ csrf_token() }}'}

and the axios request:

axios.post('http://localhost:6080/auth', {
        email: email,
        password: password,
        csrf_token:window.Laravel
      }).then(response => {
        console.log(response)
        return response
      })

Leave a comment