Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Authentication is NOT happening though I have access to the site & can upload files manually. #23

Open
v1v3kls opened this issue Mar 20, 2023 · 0 comments

Comments

@v1v3kls
Copy link

v1v3kls commented Mar 20, 2023

Hi, I am trying to upload a file to sharepoint folder. But, NOT able to authenticate. I am getting below error.

throw new Error(Unable to resolve namespace authentiation type. Type received: ${authType});

Please help.

My Code is as below,

var spauth = require('node-sp-auth');
var request = require('request-promise');
var $REST = require("gd-sprest");

// Log
console.log("Connecting to SPO");

// Connect to 
//https://someurl.sharepoint.com/sites/someteams
var url = "https://someurl.sharepoint.com/sites/someteams/_api/web/lists";
spauth.getAuth(url, {
    username: "username",//"email or username", ?
    password: "password",
    online: true
}).then(options => {
    // Log
    console.log("Connected to SPO");
    let headers = options.headers;
    headers['Accept'] = 'application/json;odata=verbose';

    request.get({
        url: `https://someurl.sharepoint.com/sites/someteams/_api/web`,
        headers: headers
      }).then(response => {
        //process data
      });
    // Code Continues in 'Generate the Request'
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant