isaacs/npm-registry-client — pull request #6 by ferlores (2012-07-10 01:48:51+00:00)
Title: Change authentication to session cookies (First approach)

From [discussion](https://github.com/isaacs/npm-www/issues/15) with Isaac in npm-www:
```
So, we really need to figure out a way to do npm actions on behalf of the logged-in
user. (This will be important for other features in the future as well.)

I think what needs to happen is that the npm-registry-client needs to be able to use
a login token cookie (like couch-login uses) instead of a username/password.
```

### Pull request content:
* client.login method added: return and store a AuthSession token in
client.token
* Auto login for authRequiered actions if user/password is available
* Update tests

### Examples
```
client.login(username, password, function (er, token) {
if (er) throw er

// keep token somewhere for further calls
save(token)

client.star(package, true, function (er, data, raw, res) {
if (er) throw er
console.log(data)
})
})
```

Please let me know if you think that it is a wrong approach