node-sp-auth
node-sp-auth copied to clipboard
error, pls help
trafficstars
error:
Unhandled rejection TypeError: Cannot read property 'length' of undefined
at getSecurityToken.then.then.data (/Users/peter/workspace/quantr-365-cli/node_modules/node-sp-auth/lib/src/auth/resolvers/OnlineUserCredentials.js:55:64)
at tryCatcher (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/promise.js:547:31)
at Promise._settlePromise (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/promise.js:604:18)
at Promise._settlePromise0 (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/promise.js:649:10)
at Promise._settlePromises (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/promise.js:729:18)
at _drainQueueStep (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/async.js:93:12)
at _drainQueue (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/async.js:86:9)
at Async._drainQueues (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/async.js:102:5)
at Immediate.Async.drainQueues [as _onImmediate] (/Users/peter/workspace/quantr-365-cli/node_modules/bluebird/js/release/async.js:15:14)
at runCallback (timers.js:705:18)
at tryOnImmediate (timers.js:676:5)
at processImmediate (timers.js:658:5)
const spauth = require('node-sp-auth');
const request = require('request-promise');
spauth
.getAuth('https://quantr.sharepoint.com', {
username: username,
password: password
})
.then(data => {
console.log(data);
var headers = data.headers;
headers['Accept'] = 'application/json;odata=verbose';
request.get({
url: 'https://quantr.sharepoint.com/_api/web',
headers: headers,
json: true
}).then(response => {
console.log(response.d.Title);
});
});
Hello, Have you had this issue before or it started happening after a while? Do you have MFA enabled? Do you use any third-party auth providers? Do you use ADFS?