0

我正在尝试在 Laravel 中使用 VueJS 进行 POST 请求,但请求失败并显示 401 状态码,我将令牌传递到标头中,但它不起作用。

const post_data = {
   headers: {
      Authorization: [api token]
   },
   params: {
      [parameters]
  }
}
axios
   .post('URL', post_data)
   .then(res => console.log(res))
4

1 回答 1

0
Authorization: "Bearer " + token or Authorization: "bearer " + token

在某些情况下,只有上述之一有效!

于 2019-12-02T15:38:25.293 回答