Add force regenerate token

This commit is contained in:
Sambo Chea 2022-11-11 09:29:20 +07:00
parent cdfe4c4fc8
commit 775b7b287b
Signed by: sombochea
GPG Key ID: 3C7CF22A05D95490
2 changed files with 3 additions and 1 deletions

View File

@ -2,6 +2,7 @@
- Fixed axios is not a function
- Add generate token with data (clientId, apiKey) to server
- Add generate token with options (-f | --force) to regenerate and override
### 20/10/2022

View File

@ -227,6 +227,7 @@ program
"setting client api key for authentication access"
)
.option("-p --profile <string>", "setting profile name", PROFILE_DEFAULT)
.option("-f --force", "force to generate new client and token", false)
.action(async (options) => {
const configDir = path.resolve(os.homedir(), PROFILE_PATH);
@ -263,7 +264,7 @@ program
config.apiKey = options.key;
}
if (!config.token) {
if (!config.token || options.force) {
console.log("Generating token...");
await getTokenFree(config.server, {
timestamp: (new Date().getTime()),