janjoerke / vscode-jenkins-pipeline-linter-connector

MIT License
60 stars 21 forks source link

Fix token auth (instead of setting headers) #31

Closed ohartl closed 3 months ago

ohartl commented 3 years ago

Fixes #19, #27 and #30. Also makes #15 obsolete.

I noticed that token auth wasn't working and having my password in plain text isn't an option.

Seems like Object.assign throws the error Cannot convert undefined or null to object because options.headers wasn't defined before. But i decided, instead of setting the headers to empty object above (like #15 does), using the options.auth to keep it consistent. The code for token auth previously must have been missed that part when updating to options.auth.

The failure grabbed from VSCode Extension Host Logs was

[2021-04-26 17:54:48.096] [exthost] [error] TypeError: Cannot convert undefined or null to object
    at Function.assign (<anonymous>)
    at requestCrumb (c:\Users\<user>\.vscode\extensions\janjoerke.jenkins-pipeline-linter-connector-1.2.0\out\extension.js:65:38)
    at c:\Users\<user>\.vscode\extensions\janjoerke.jenkins-pipeline-linter-connector-1.2.0\out\extension.js:36:17
    at Generator.next (<anonymous>)
    at c:\Users\<user>\.vscode\extensions\janjoerke.jenkins-pipeline-linter-connector-1.2.0\out\extension.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (c:\Users\<user>\.vscode\extensions\janjoerke.jenkins-pipeline-linter-connector-1.2.0\out\extension.js:3:12)
    at c:\Users\<user>\.vscode\extensions\janjoerke.jenkins-pipeline-linter-connector-1.2.0\out\extension.js:17:104
    ... (truncated here)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at Socket.Readable.push (_stream_readable.js:212:10)
    at Pipe.onStreamRead (internal/stream_base_commons.js:186:23) jenkins.pipeline.linter.connector.validate
ohartl commented 3 years ago

@janjoerke Ping back, this is important to make the plugin work for Jenkins API Token auth again.

jhd235 commented 1 year ago

@ohartl @janjoerke Hi, I'm having this issue. Maybe you have news on resolving this? thanks, regards

jhd235 commented 1 year ago

@ohartl any news, please?

bashbers commented 1 year ago

I'd like to see this merged as well. It's not intuitive to paste the token code in the password field when there is a designated token setting field.

sbrahul commented 12 months ago

Is there a way to get the plugin with the fix? Anyway to compile locally and install it with the fix?

dqwork commented 11 months ago

Would love to see this merged - I've manually made this change on my local install and it fixes this problem

ohartl commented 3 months ago

Well, maintainer is inactive, I cannot to anything