dongzhan1492 2018-01-24 09:09
浏览 280

419(未知状态)使用AXIOS和Laravel的POST请求出错

Sorry to bother all of you. I have searched many times. I tried the probable solution too. I have set the csrf_token using meta tag

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

My POST request is like the below

tryAuth () {

  if (this.$refs.form.validate()) {

    let _this = this

    axios.post('/trylogin',_this.loginInfo, {
      headers: {
        //'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').getAttribute('content')
      },
      //withCredentials: true
    }).then(function(response){

      console.log(response.data)

    })
    .catch(function(error){

    })

  }

I have tried both using with and without the headers. Sometimes the response is okay but sometimes it shows 419 error response.

I am using Laravel 5.5 and AXIOS latest version. Any help would be appreciated. I have found some solution and tried but didn't work for me.

Thanks :)

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 教务系统账号被盗号如何追溯设备
    • ¥20 delta降尺度方法,未来数据怎么降尺度
    • ¥15 c# 使用NPOI快速将datatable数据导入excel中指定sheet,要求快速高效
    • ¥15 再不同版本的系统上,TCP传输速度不一致
    • ¥15 高德地图点聚合中Marker的位置无法实时更新
    • ¥15 DIFY API Endpoint 问题。
    • ¥20 sub地址DHCP问题
    • ¥15 delta降尺度计算的一些细节,有偿
    • ¥15 Arduino红外遥控代码有问题
    • ¥15 数值计算离散正交多项式