@cnbcool/cnb-api-generate 2.4.3 → 2.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/client/lib/login.ts
CHANGED
|
@@ -16,13 +16,12 @@ export function registerLoginCommand(program: Command): void {
|
|
|
16
16
|
.description('通过 OAuth2 设备授权流登录 CNB,获取并保存 access_token')
|
|
17
17
|
.option('--client-id <string>', 'OAuth2 client_id', process.env.OAUTH2_CLIENT_ID || 'cnb_cli')
|
|
18
18
|
.option('--woa', '使用内网环境 (https://cnb.woa.com)', false)
|
|
19
|
-
.option('--host <string>', '指定自定义域名 (优先级高于 --woa)')
|
|
20
19
|
.option('--debug', '打印调试信息', false)
|
|
21
20
|
.helpOption('-h, --help', '显示帮助文档')
|
|
22
21
|
.action(async (opts) => {
|
|
23
22
|
const cfg: LoginConfig = {
|
|
24
23
|
clientID: opts.clientId,
|
|
25
|
-
platformURL: opts.
|
|
24
|
+
platformURL: opts.woa ? 'https://cnb.woa.com' : 'https://cnb.cool',
|
|
26
25
|
debug: opts.debug,
|
|
27
26
|
};
|
|
28
27
|
|
|
@@ -39,6 +39,7 @@ export async function refreshAccessToken(store: TokenStore): Promise<string> {
|
|
|
39
39
|
refresh_token: tok.refresh_token || store.refresh_token,
|
|
40
40
|
platform_url: store.platform_url,
|
|
41
41
|
client_id: store.client_id,
|
|
42
|
+
login_host: store.login_host,
|
|
42
43
|
};
|
|
43
44
|
saveToken(newStore);
|
|
44
45
|
|