-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #101 from Cox-Automotive/develop
3.0.0 Release
- Loading branch information
Showing
25 changed files
with
391 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
process.title = 'ALKS'; | ||
|
||
var program = require('commander'), | ||
clc = require('cli-color'), | ||
_ = require('underscore'), | ||
opn = require('opn'), | ||
alks = require('alks-node'), | ||
config = require('../package.json'), | ||
utils = require('../lib/utils'), | ||
Developer = require('../lib/developer'); | ||
|
||
program | ||
.version(config.version) | ||
.description('stores your alks refresh token') | ||
.option('-v, --verbose', 'be verbose') | ||
.parse(process.argv); | ||
|
||
var logger = 'dev-login-2fa'; | ||
|
||
utils.log(program, logger, 'loading developer'); | ||
Developer.getDeveloper(function(err, data){ | ||
console.error('Opening ALKS 2FA Page.. Be sure to login using Okta..'); | ||
opn(data.server.replace(/rest/, 'login/getToken.htm')); | ||
console.error('Please copy your refresh token from ALKS and paste below..'); | ||
|
||
Developer.getPasswordFromPrompt(function(err, refreshToken){ | ||
utils.log(program, logger, 'exchanging refresh token for access token'); | ||
|
||
alks.refreshTokenToAccessToken(data, refreshToken, { debug: program.verbose, ua: utils.getUA() }, function(err, data){ | ||
if(err){ | ||
return utils.errorAndExit('Error validating refresh token. ' + err.message); | ||
} | ||
|
||
console.error(clc.white('Refresh token validated!')); | ||
Developer.storeToken(refreshToken, function(err, saved){ | ||
if(!saved){ | ||
utils.log(program, logger, 'error saving token! ' + err.message); | ||
utils.passwordSaveErrorHandler(err); | ||
} | ||
else{ | ||
console.error(clc.white('Refresh token saved!')); | ||
} | ||
|
||
utils.log(program, logger, 'checking for updates'); | ||
utils.checkForUpdate(); | ||
Developer.trackActivity(logger); | ||
|
||
setTimeout(function(){ process.exit(0); }, 1000); // needed for if browser is still open | ||
}); | ||
}); | ||
}, 'Refresh Token'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env node | ||
'use strict'; | ||
|
||
process.title = 'ALKS'; | ||
|
||
var program = require('commander'), | ||
clc = require('cli-color'), | ||
_ = require('underscore'), | ||
config = require('../package.json'), | ||
utils = require('../lib/utils'), | ||
Developer = require('../lib/developer'); | ||
|
||
program | ||
.version(config.version) | ||
.description('removes alks refresh token') | ||
.option('-v, --verbose', 'be verbose') | ||
.parse(process.argv); | ||
|
||
var logger = 'dev-logout2fa'; | ||
|
||
if(Developer.removeToken()){ | ||
console.error(clc.white('Token removed!')); | ||
} | ||
else{ | ||
console.error(clc.red.bold('Error removing toking!')); | ||
} | ||
|
||
utils.log(program, logger, 'checking for updates'); | ||
utils.checkForUpdate(); | ||
Developer.trackActivity(logger); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.