You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
722 B

  1. /*******************************
  2. GitHub Login
  3. *******************************/
  4. /*
  5. Logs into GitHub using OAuth
  6. */
  7. var
  8. fs = require('fs'),
  9. path = require('path'),
  10. githubAPI = require('github'),
  11. // stores oauth info for GitHub API
  12. oAuthConfig = path.join(__dirname, 'oauth.js'),
  13. oAuth = fs.existsSync(oAuthConfig)
  14. ? require(oAuthConfig)
  15. : false,
  16. github
  17. ;
  18. if(!oAuth) {
  19. console.error('Must add oauth token for GitHub in tasks/config/admin/oauth.js');
  20. }
  21. github = new githubAPI({
  22. version : '3.0.0',
  23. debug : true,
  24. protocol : 'https',
  25. timeout : 5000
  26. });
  27. github.authenticate({
  28. type: 'oauth',
  29. token: oAuth.token
  30. });
  31. module.exports = github;