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

Login to Microsoft products aren't working anymore #68531

Closed
peni4142 opened this issue Feb 12, 2019 · 26 comments
Closed

Login to Microsoft products aren't working anymore #68531

peni4142 opened this issue Feb 12, 2019 · 26 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug proxy Issues regarding network proxies verified Verification succeeded
Milestone

Comments

@peni4142
Copy link

Version: 1.31.0 (user setup)
Commit: 7c66f58
Date: 2019-02-05T22:35:56.624Z
Electron: 3.1.2
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134

Steps to Reproduce:

  1. Install any version of VSCode (it will upgrade by itself) || when did that start? not NodeJS style!
  2. Create an extension, which tries to authenticate to a Microsoft-service/product (TFS/SharePoint) programmatically.

Did come with the last update. It is very embarrassing that my boss has prepared a showcase and would like to present it very promptly. Since you seem to have introduced an automatic update for all versions, there is no workaround for the meeting. This looks very unprofessional.
Very embarrassing.

I used "https://www.npmjs.com/package/node-sp-auth" for authentification.
Someone else seems to have a problem with TFS:
#68442

@vscodebot vscodebot bot added the install-update VS Code installation and upgrade system issues label Feb 12, 2019
@chrmarti
Copy link
Contributor

@peni4142 For your boss:

For you: Check if your extension uses any native modules. These need to be recompiled for VS Code 1.31. If that's not the cause we need more information on what is going wrong.

@chrmarti chrmarti added info-needed Issue requires more information from poster and removed install-update VS Code installation and upgrade system issues labels Feb 12, 2019
@peni4142
Copy link
Author

That are dependencies

"dependencies": {
		"@types/request": "^2.47.1",
		"@types/ws": "^5.1.2",
		"@types/xml2js": "^0.4.3",
		"await-notify": "1.0.1",
		"node-sp-auth": "2.5.7",
		"setenv": "^1.0.3",
		"vscode": "^1.1.21",
		"vscode-debugadapter": "1.27.0",
		"vscode-debugprotocol": "1.27.0",
		"vscode-languageclient": "^4.4.2",
		"vscode-languageserver": "^4.4.2",
		"ws": "^5.2.2",
		"xml2js": "^0.4.19"
	}

I don't have written native code on my own. Does that mean I have to wait till third-party modules are recompiled and newly provided?

I am using pretty much this code:

import * as spauth from 'node-sp-auth';
import * as request from 'request-promise';

spauth
  .getAuth('http://xxx.botshop.cloudappsportal.com/', {
    username: 'administrator',
    password: '[password]',
    domain: 'sp'
  })
  .then(data =>{
    let headers = data.headers;
    headers['Accept'] = 'application/json;odata=verbose';
    let requestOpts = data.options;
    requestOpts.json = true;
    requestOpts.headers = headers;
    requestOpts.url = 'http://xxx.botshop.cloudappsportal.com/_api/web/lists/getbytitle('myfile')/items';

    request.get(requestOpts).then(response => {
      console.log(response.d.Title);
    });
});

snipptet is from: https://stackoverflow.com/questions/51993317/access-sharepoint-document-from-node-js-in-ibm-cloud-function

out of the box, it is working. Using it in a VSCode context, it does not work. In one of the out of the box tests, I used NodeJS v10.2.0 as used in VSCode. If it helps I run very frequently npm i.

@ewchris
Copy link

ewchris commented Feb 12, 2019

I'm having the same problem. After updating to the newest version of VSCode, I am unable to connect to TFS using Azure Repos. I downgraded VSCode to the november release (https://code.visualstudio.com/updates/v1_30) and the issue was fixed. My VSCode also auto-updated and the issue reappeared.

@chrmarti Thanks for the tip on disabling auto-update. :)

@peni4142
Copy link
Author

@chrmarti Oh yes, thanks for the tip. That will help for the showcase.

@chrmarti
Copy link
Contributor

@peni4142 Your dependencies could include or depend on native modules.

Can you also try with the new proxy support disabled in the settings?

@peni4142
Copy link
Author

Yeah that is it. Disabling Proxy Support
(Http: Proxy Support
Use the proxy support for extensions.)
"solve" the problem...

@peni4142
Copy link
Author

--funny: The German translation of the wording contains different information content than in English. Both describe it more precisely in different respects.

@peni4142
Copy link
Author

Is there something I have to do, that it works with the new proxy feature or do you have to fix it?

@chrmarti
Copy link
Contributor

@peni4142 Are you or one of the node modules using an agent on the options to http/s.get/request? I need to better understand why this is failing before I tell what the best way forward is.

@chrmarti chrmarti added this to the February 2019 milestone Feb 13, 2019
@chrmarti chrmarti added the bug Issue identified by VS Code Team member as probable bug label Feb 13, 2019
@peni4142
Copy link
Author

Working with Authorization-Token.

Thats what my header looks like:

{
"Connection":"Close",
"Authorization":"Nonsense",
"Accept":"*/*"
}

@peni4142
Copy link
Author

Seems to be fixed in 1.31.1.

@peni4142
Copy link
Author

My co-worker says it still does not work. Did you do something about that?

@chrmarti
Copy link
Contributor

@peni4142 Nothing changed in that area between 1.31.0 and 1.31.1. Make sure you have that proxy support set to override (the default).

Can you add error logging to your code, so we see why it fails?

@peni4142
Copy link
Author

Another colleague has confirmed this, but apparently, I can not reactivate the feature. That means I can not test whether the problem is resolved.

@peni4142
Copy link
Author

I had an empty 401, but I can't reproduce that. Seems I can't reactivate that Feature.

@sg-chrishasz
Copy link

sg-chrishasz commented Feb 13, 2019

I am the author of SPGo and I can confirm users who are using NTLM authentication are also experiencing this issue as of VSCode 1.31.x:

@chrmarti I can confirm the workaround of changing the value of http.proxySupport from Override to either on or off will resolve the issue.

My question is why the default value is set to Override rather than either of the other non-intrusive values? Do you have a suggestion for extension authors (not end users who may not know to disable auto-updates for properties) for how to work around situations such as this?

More Context (from chrishasz/spgo#73):

Finally, here is a simple set of reproduction steps you can perform to reproduce the issue:

  1. Use yo code Yeoman generator to create a new VSCode extension
  2. Add sp-request to the project: npm install --save sp-request
  3. Add a require reference to sp-request at the top of the file, then replace the default code inside the extension.sayHello command registration with the following code: (obviously specifying your own domain, password and username values)
let credentialOptions = {
    domain : 'domain'
    password : 'xxxx',
    username : 'username'
}
let endpoint = '<ntlm-secured SharePoint site>';

let spr = sprequest.create(credentialOptions);

spr.requestDigest(endpoint)
    .then(function(requestResults) {
        console.log("auth success!");
        console.log("For more, please check the results\n", JSON.stringify(requestResults));
    })
    .catch(function(err) {
        console.log("Core error has happened \n", err);
    });
  1. run the extension and you will receive the error: 401 - undefined. The "undefined" value comes from the empty body returned from the remote server.

Happy to help debug this further or provide any more info to help resolve as it is affecting a large number of users.

updated: added a few clarifying details

@chrmarti
Copy link
Contributor

chrmarti commented Feb 14, 2019

@sg-chrishasz Thanks for the analysis. We figured we can improve the proxy support for all extensions if we override any existing agent (which is often used to support proxies) with our own that can use the OS proxy configuration.

It looks like in this case proxies are not necessarily part of the system's configuration. A possible fix appears to be to just use the original agent (e.g., from node-sp-auth) when there is no proxy configured for the contacted host. This would fix the breakage, it would not help users behind network proxies, but for these node-sp-auth did not work before either, so there would be no loss of functionality from what I see.

@peni4142
Copy link
Author

How would it be handled in the future? Do I have to tell everybody to change the proxy entry? or would it be fixed in newer versions?

@chrmarti
Copy link
Contributor

@peni4142 The goal is to make it work in newer versions.

@sg-chrishasz
Copy link

@chrmarti - Thanks for the response. I like the proxy override capability and the original intent makes sense in that context, but definitely think it should not be the default option.

Please let us know when you expect an update to the default proxy setting (or similar remediation) to be released.

@chrmarti chrmarti removed the info-needed Issue requires more information from poster label Feb 15, 2019
@peni4142
Copy link
Author

"StatusCodeError: 401 - undefined
at new StatusCodeError (C:__GIT\Repo\ext\node_modules\request-promise-core\lib\errors.js:32:15)
at Request.module.exports.plumbing.callback (C:__GIT\Repo\ext\node_modules\request-promise-core\lib\plumbing.js:104:33)
at Request.RP$callback [as _callback] (C:__GIT\Repo\ext\node_modules\request-promise-core\lib\plumbing.js:46:31)
at Request.init.self.callback (C:__GIT\Repo\ext\node_modules\request\request.js:185:22)
at Request.emit (events.js:182:13)
at Request. (C:__GIT\Repo\ext\node_modules\request\request.js:1157:10)
at Request.emit (events.js:182:13)
at IncomingMessage. (C:__GIT\Repo\ext\node_modules\request\request.js:1079:12)
at Object.onceWrapper (events.js:273:13)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1090:12)
at process._tickCallback (internal/process/next_tick.js:63:19)"

chrmarti added a commit that referenced this issue Feb 18, 2019
@chrmarti
Copy link
Contributor

@peni4142 @grizzlysol @sg-chrishasz I have added a fix for today's insiders build, could you give that a try and let me know if that fixes the problem with the setting set to 'override'? Download: https://code.visualstudio.com/insiders/

@s-KaiNet
Copy link

@chrmarti I'm node-sp-auth author, I tested insiders build with SPGo extension and everything looks good with default override setting! Thank you!

Let's wait for confirmation from other guys as well.

@sg-chrishasz
Copy link

Hello @chrmarti - I can also confirm that NTLM authentication for SPGo is again working in the latest insider's build when proxy is set to override.

Thanks for the quick turn-around!

@chrmarti
Copy link
Contributor

Closing as fixed, thanks!

sandy081 pushed a commit to vldmrkl/vscode that referenced this issue Feb 22, 2019
@mjbvz mjbvz added the verified Verification succeeded label Feb 26, 2019
@mjbvz
Copy link
Contributor

mjbvz commented Feb 26, 2019

Marking as verified by users

@vscodebot vscodebot bot locked and limited conversation to collaborators Apr 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug proxy Issues regarding network proxies verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants