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

error, pls help #73

Open
quantrpeter opened this issue Mar 3, 2020 · 1 comment
Open

error, pls help #73

quantrpeter opened this issue Mar 3, 2020 · 1 comment

Comments

@quantrpeter
Copy link

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);
		});
	});
@s-KaiNet
Copy link
Owner

s-KaiNet commented Mar 4, 2020

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?

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

2 participants