如何从Laravel API获取Auth令牌并立即在http / ajax / axios请求中使用该令牌?

JS / Client

Vue.axios.post('http://laravelApi:8000/here', {someData}).then(response->{ 
  console.log(response.data); 
});

PHP / API

route::post('/here', function(){
  response...
});

返回并重新发布csrf-token是否有一个受欢迎的模式?我可以在初始请求和包含cors令牌的后续请求之间以不同方式定义标头吗?

我可以存储第一个响应中的laravel_sesson和/或XSRF-TOKEN cookie,并将其包含在后续响应中 . 有人能指出我的资源或代码示例吗?

我一直在laravel中找到捆绑在一台服务器/主机上的vue的示例,并希望找到有关csrf令牌异步实现的说明 . 谢谢!

Edit: Lots of good answers around for this one, but not so many at the time of posting. CSRF token doesn't need to be generated at request-time but instead persists throughout session.