diff options
author | Forrest L Norvell <forrest@npmjs.com> | 2014-06-14 08:46:03 +0400 |
---|---|---|
committer | Forrest L Norvell <forrest@npmjs.com> | 2014-07-02 05:16:29 +0400 |
commit | 0ac7ca233f7a69751fe4386af6c4daa3ee9fc0da (patch) | |
tree | acc4dd38ad5b991eb45e3c32552fdb276ca647cb | |
parent | 176c6a528d2abbd3d36b76d9b649981caf23791a (diff) |
capture and store bearer token
-rw-r--r-- | lib/adduser.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/adduser.js b/lib/adduser.js index 579ecb0a9..62e6ce0b8 100644 --- a/lib/adduser.js +++ b/lib/adduser.js @@ -133,16 +133,21 @@ function save (c, u, cb) { } npm.spinner.start() // save existing configs, but yank off for this PUT - registry.adduser(npm.config.get("registry"), u.u, u.p, u.e, function (er) { + registry.adduser(npm.config.get("registry"), u.u, u.p, u.e, function (er, doc) { npm.spinner.stop() if (er) return cb(er) registry.username = u.u registry.password = u.p registry.email = u.e + // don't want this polluting the configuration + npm.config.del("_token", "user") npm.config.set("username", u.u, "user") npm.config.set("_password", u.p, "user") + // TODO: on-prem should move to scoped modules / multi-registry + if (doc && doc.token) { + npm.config.set("_authToken", doc.token, "user") + } npm.config.set("email", u.e, "user") - npm.config.del("_token", "user") log.info("adduser", "Authorized user %s", u.u) npm.config.save("user", cb) }) |