admin管理员组文章数量:1322360
i have to add the header access token
$scope.dropzoneConfig = {
'options': { // passed into the Dropzone constructor
'url': 'SOME API URL' + $scope.SOME_ID
},
'eventHandlers': {
'sending': function (file, xhr, formData) {
},
'success': function (file, response) {
}
}};
And my header access token is
{ headers: { 'Authorization': 'Bearer ' + $scope.access_token } }
and i need to add this to the url or the api that i am trying to call
i have to add the header access token
$scope.dropzoneConfig = {
'options': { // passed into the Dropzone constructor
'url': 'SOME API URL' + $scope.SOME_ID
},
'eventHandlers': {
'sending': function (file, xhr, formData) {
},
'success': function (file, response) {
}
}};
And my header access token is
{ headers: { 'Authorization': 'Bearer ' + $scope.access_token } }
and i need to add this to the url or the api that i am trying to call
Share Improve this question asked May 11, 2017 at 7:22 Omkar DixitOmkar Dixit 7661 gold badge9 silver badges20 bronze badges 1- can you tried headers: { 'Authorization': 'Bearer ' + $scope.access_token } – Ranjeet Singh Commented May 11, 2017 at 7:38
2 Answers
Reset to default 7You can add the header in the headers options
of your dropzone
object.
Check the headers
attribute in the options in the following example:
$("#dropzone").dropzone({
autoProcessQueue: false,
url: "/content",
maxFiles: 1,
clickable: true,
acceptedFiles: ".png,.jpg,.jpeg",
addRemoveLinks: true,
maxFilesize: 10, //MB
headers:{"Authorization":'Bearer ' + $scope.access_token},
});
const getUploadParams = ({ file, meta }) => {
const body = new FormData();
let headers;
UserTool.getToken((token) => {
headers= { Authorization: `Bearer ${token}` }
body.append('file', file, file.name)
});
return { url: UrlConfig.tileset.uploadUrl, body, headers }
}
本文标签: javascripthow to include the header access token to the Dropzone configStack Overflow
版权声明:本文标题:javascript - how to include the header access token to the Dropzone config - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742112725a2421325.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论