node.js - 使用 OneDrive (NodeJS) 上传文件期间访问被拒绝
问题描述
我目前正在尝试将我的文件上传回OneDrive。
我一直在关注 OneDrive Graph文档和 Tanaike 的示例。
我能够创建一个上传会话,但是当我尝试将字节上传到上传会话时,我得到了
function uploadFile(uploadUrl, context) { // Here, it uploads the file by every chunk.
asy.eachSeries(getparams(), function(st, callback){
setTimeout(function() {
fs.readFile(file, function read(e, f) {
context.log(st.cr);
//context.log(st.clen);
request.put({
url: uploadUrl,
headers: {
//'Content-Length': st.clen,
'Content-Range': st.cr,
},
body: f.slice(st.bstart, st.bend + 1),
}, function(er, re, bo) {
if(er){
context.log(' Upload Error' + bo);
}
else{
context.log(' ERROR HERE: ' + bo);
context.res = {
// status: 200, /* Defaults to 200 */
headers: {'Content-Type': 'application/json'},
body: bo
};
}
});
});
callback();
}, st.stime);
});
}
来自 PUT 请求的响应:
"error":{"code":"accessDenied","message":"The caller does not have permission to perform the action."}
我已经检查并确定我是该文件夹的所有者。我做了很多谷歌搜索,但我无法找到我是如何被拒绝的。
我也在邮递员上试过,同样的错误。我离开了 Authorization Header 字段,并且
标题
Content-Range:bytes 0-4019880/4019881
Content-Type:application/x-www-form-urlencoded
以前试过这个的人可以指导我吗?
解决方案
推荐阅读
- eslint - error 解析错误:md 文件中出现意外的字符“#”
- maven - 即使测试失败,GOCD 阶段也是绿色的
- php - 如何使用 chencha 共享库在电子邮件中共享媒体文件
- javascript - 有没有办法从 webpack 获取依赖树?
- html - 将 PrimeNG 组件彼此相邻对齐,而不是彼此下方对齐
- spring-boot - 使用 Keycloak 的 Spring Boot 应用程序的 Oauth2 登录失败
- node.js - JSON.parse 字符串未定义
- java - 使用注释时忽略“web.xml”中的过滤顺序?
- django - 当再次部署 django 应用程序时,计划的 Celery 任务仍在进行中
- gradle - java:当我尝试生成 JPA 静态元模型并在 Intellij IDE 中使用它时出现重复类