Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I get /_api/contextinfo 401 (Unauthorized) document upload

See original GitHub issue

When 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
     .files.add(, file, true)
     .then(_ => Logger.write("done"));
 } else {
   // large upload
       data => {
           data: data,
           level: LogLevel.Verbose,
           message: "progress"
     .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:closed
  • Created 6 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

tobiashoeftcommented, Feb 19, 2018

Hey thx for reply! Thx !!!

Yeah exactly! That’s why it don’t work.

Thx 😄 !

You’re awesome!

koltyakovcommented, Feb 20, 2018

Thanks! Closing the issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found