I get /_api/contextinfo 401 (Unauthorized) document upload
See original GitHub issueWhen i try upload a document to libary i get 401
Here my code : OPTIONS http://XXXXXX/_api/contextinfo 401 (Unauthorized)
I use sp-pnp-js and your sp-rest-proxy for locally development.
const siteUrl = "http://XXXXXXX/XXXXXXX/";
this.web = new Web(siteUrl);
if (file.size <= 10485760) {
// small upload
this.web
.getFolderByServerRelativeUrl("/Shared%20Documents/")
.files.add(file.name, file, true)
.then(_ => Logger.write("done"));
} else {
// large upload
this.web
.getFolderByServerRelativeUrl("/Shared%20Documents/")
.files.addChunked(
file.name,
file,
data => {
Logger.log({
data: data,
level: LogLevel.Verbose,
message: "progress"
});
},
true
)
.then(_ => Logger.write("done!"));
}
}
"dependencies": {
"@angular/animations": "^5.2.3",
"@angular/common": "^5.2.3",
"@angular/compiler": "^5.2.3",
"@angular/core": "^5.2.3",
"@angular/forms": "^5.2.3",
"@angular/http": "^5.2.3",
"@angular/platform-browser": "^5.2.3",
"@angular/platform-browser-dynamic": "^5.2.3",
"@angular/router": "^5.2.3",
"@angularclass/hmr": "^2.1.3",
"@ultimate/ngxerrors": "^1.4.0",
"bevlis-spa-kaf-list": "0.0.31",
"bootstrap": "^4.0.0",
"classlist.js": "^1.1.20150312",
"core-js": "^2.5.3",
"cssnano": "^3.10.0",
"font-awesome": "^4.7.0",
"intl": "^1.2.5",
"jquery": "^3.3.1",
"ngx-bootstrap": "^2.0.2",
"ngx-loading": "^1.0.14",
"ngx-modal-dialog": "^1.1.1",
"postcss": "^6.0.17",
"rxjs": "^5.5.6",
"sp-pnp-js": "^3.0.5",
"weakmap": "0.0.6",
"web-animations-js": "^2.3.1",
"zone.js": "^0.8.20"
},
"devDependencies": {
"@angular/cli": "^1.6.8",
"@angular/compiler-cli": "^5.2.3",
"@angular/language-service": "^5.2.3",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "~9.4.1",
"codelyzer": "~4.1.0",
"jasmine-core": "~3.0.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.4.1",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.3.0",
"sp-rest-proxy": "^2.5.4",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.7.1"
}
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (6 by maintainers)
Top Results From Across the Web
Getting 401 Unauthorized error when posting REST call
Hi, I am trying to get the form digest value for SharePoint2016 using the REST POST call to /_api/contextinfo.
Read more >401 Unauthorized Access Error with SharePoint NTLM ...
I am writing this post after I fixed an issue with SharePoint file upload APIs at one of our clients' environment. Note: The...
Read more >401 error while uploading file to Sharepoint 2013 using REST ...
I have a simple html form where i have request is built to upload a file to Sharepoint Server 2013 using REST (...
Read more >401 Unauthorized Exception with SharePoint search rest API
You need to call the spcontextinfo through rest and get the FormDigest first. Call http://server/web/doclib/forms/_api/contextinfo using POST.
Read more >REST – Share SharePoint Points ! - By Mohit Vashishtha
To avoid the Unauthorized exception, we have to add some request header values to the API request. Authentication and Authorization of ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey thx for reply! Thx !!!
Yeah exactly! That’s why it don’t work.
Thx 😄 !
You’re awesome!
Thanks! Closing the issue.