Skip to content

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

@v1v3kls

Description

@v1v3kls

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'
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions