mikedeboer/node-github — pull request #114 by henvic (2014-01-05 08:19:45+00:00)
Title: Fix incompatibility with the new GitHub's two-factor authentication feature

Close #98.

It's a single line that fixes it: white-list the X-GitHub-OTP header, which shall be passed when GitHub claims the user has to use X-GitHub-OTP.

If you don't use it: nothing changes.

If you want to use it from now on: you'll want to ask for an authorization token for your app (you do that with `github.authenticate`), otherwise you'll need to send fresh 2nd factor codes every few minutes. Once you do get the authorization token you aren't bothered anymore. Maybe my commit 8362efc should not be merged at all just to avoid people getting confused when they try to use an invalidated old code.

You may want to ask the user for the code just after a authentication failure / 401 due to the token being missing to simplify things or ask upfront, this way you can cover both users of the SMS type and as well users who have a software-based token like Google Auth on their mobile devices.

Example of authenticating with the code:
```javascript
var payload = {
headers: {
'X-GitHub-OTP': 01234
},
note: 'Node GH',
note_url: 'https://github.com/eduardolundgren/node-gh',
scopes: ['user']
};

it("should successfully execute GET /authorizations (getAll)", function(next) {
client.authorization.create(payload, function(err, res) {
console.log('err:' + err);
console.log('res:' + JSON.stringify(res));
next();
});

});
```