简体   繁体   English

使用 jwt 令牌 angular 上传文件

[英]File upload with jwt token angular

I am trying to upoload a file to my laravel backend using form data and I need to send the jwt bearer token.我正在尝试使用表单数据将文件上传到我的 laravel 后端,我需要发送 jwt 不记名令牌。 What headers should I use.我应该使用什么标题。

You should send Authorization header with your request.您应该随请求发送授权 header。 please try like this.请尝试这样。

const headers = new Headers({
      'Authorization': `Bearer ${token}`
})

return this.http.post(apiUrl,formData , { headers: headers })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM