node-jenkins icon indicating copy to clipboard operation
node-jenkins copied to clipboard

Authenticate once

Open osher opened this issue 8 years ago • 2 comments

Is there a way to authenticate once and use a session-token instead of sending creds in plain text for every request?

I would expect it to implement an .authenticate(user,pwd, callback(err, token)) method, and work with a session-token instead of sending creds in plain text...

Maybe there is?

I did see I can inject whatever headers to each request. Is that what you mean users to hook on? In that case - is there a method that just authenticates and provides valid cookie / token / auth header?

osher avatar Jun 28 '17 14:06 osher

You can just pass in the username/token fields the same way you pass in the username/password fields. I don't know if Jenkins has an API for generating tokens. If you find one I'm not against implementing it, but I haven't run across it yet.

silas avatar Jun 29 '17 05:06 silas

I've also looked at this issue and not really found out if Jenkins supports that kind of token-based authentication. You can get the indefinitely living API token from Jenkins' UI or fetch it programmatically as explained here, but that's hacky at best.

Domuska avatar Apr 05 '19 07:04 Domuska