From ad9c0465329eec3c49181230c4b7c0c1511cd83f Mon Sep 17 00:00:00 2001 From: Mark Coleman Date: Mon, 28 Nov 2016 14:02:25 +1300 Subject: [PATCH 1/2] Add two-factor auth cli documentation --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index adb3e2f..9210ec8 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,26 @@ github.auth.config({ }); ``` +**With two-factor auth:** + +If two-factor authentication is enabled then you will need to supply the One Time Password (OTP) within the auth configuration. Ensure that the scopes argument is an object containing the required `note` property. + +```js + +var scopes = { + 'add_scopes': ['user', 'repo', 'gist'], + 'note': 'admin script' +}; + +github.auth.config({ + username: 'pksunkara', + password: 'password', + otp: '46692' +}).login(scopes, function (err, id, token) { + console.log(id, token); +}); +``` + #### Revoke authentication to github in cli mode (desktop application) ```js From 83338447396252569f44434f2cac5a61c2764a8e Mon Sep 17 00:00:00 2001 From: Mark Coleman Date: Tue, 29 Nov 2016 08:38:45 +1300 Subject: [PATCH 2/2] Consolidate CLI desktop documentation --- README.md | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 9210ec8..821a899 100644 --- a/README.md +++ b/README.md @@ -113,21 +113,9 @@ __Many of the below use cases use parts of the above code__ #### Authenticate to github in cli mode (desktop application) -```js -github.auth.config({ - username: 'pksunkara', - password: 'password' -}).login(['user', 'repo', 'gist'], function (err, id, token) { - console.log(id, token); -}); -``` - -**With two-factor auth:** - -If two-factor authentication is enabled then you will need to supply the One Time Password (OTP) within the auth configuration. Ensure that the scopes argument is an object containing the required `note` property. +**Note:** Ensure that the scopes argument is an object containing the required `note` property. For two-factor authentication add the One Time Password `otp` key with its corresponding code to the configuration object. ```js - var scopes = { 'add_scopes': ['user', 'repo', 'gist'], 'note': 'admin script' @@ -135,8 +123,7 @@ var scopes = { github.auth.config({ username: 'pksunkara', - password: 'password', - otp: '46692' + password: 'password' }).login(scopes, function (err, id, token) { console.log(id, token); });