Pass csrf token from Laravel to Vue

前端 未结 1 1681
说谎
说谎 2021-01-20 04:09

Pass csrf token from Laravel to Vue I have a separate Vue app for client and Laravel for back-end (API). I use Cookies so I need csrf prote

1条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-20 04:56

    Take a look at this documentation

    If you add this to your blade template in the head then you can always pull the CSRF token from there

    
    

    And you can then fetch said CSRF token by doing this

    $('meta[name="csrf-token"]').attr('content')
    

    0 讨论(0)
提交回复
热议问题