diff --git a/CHANGELOG.md b/CHANGELOG.md index a91948b..fe2e775 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/client.ts b/src/client.ts index b9aa793..3d76e60 100644 --- a/src/client.ts +++ b/src/client.ts @@ -227,6 +227,7 @@ program "setting client api key for authentication access" ) .option("-p --profile ", "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()),