code: function getToken (client) {
    debug("getToken");
    console.log("No token found to access Github API. I will now ask for your username and password to generate one.");
    console.log("Those information ARE NOT STORED, only the generated token will be stored in your global git configuration.");
    console.log("If you don't want to let this process go you'll have to generate a token yourself and then save it with 'github-todos config github.token <your token>'.");
  
    return ask([
      {"type": "input",     "message": "Github username", "name": "user"},
      {"type": "password",  "message": "Github password", "name": "password"}
    ]).then(function (answers) {
  
      client.authenticate({
        "type":     "basic",
        "username": answers.user,
        "password": answers.password
      });
  
      var payload = {
        "note":     "Github-Todos (" + (new Date()) + ")",
        "note_url": "https://github.com/naholyr/github-todos",
        "scopes":   ["user", "repo"]
      };
  
      return Promise.promisify(client.authorization.create, client.authorization)(payload)
        .then(null, function (err) {
          if (err && err.code === 401 && err.message && err.message.indexOf("OTP") !== -1) {
            // Two-factor authentication
            console.log("You are using two-factor authentication, please enter your code to finish:");
            return twoFactorAuth(client, payload);
          } else {
            throw err;
          }
        })
        .then(saveToken(client));
    });
  }
docs: Authenticate then stores OAuth token to user's configuration for later use Client ~→ void