Skip to content

Commit 35314f0

Browse files
committed
Fix --oauth not recognized on non-login commands and stale env read after interactive login
1 parent cd65abb commit 35314f0

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

bin/commands/login.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,18 @@ export async function setupUser(argv, env) {
7373
default: getConfig()?.current?.env,
7474
prompt: 'never'
7575
},
76-
username: {
76+
username: {
7777
type: 'input'
7878
},
79-
password: {
79+
password: {
8080
type: 'password'
8181
},
8282
interactive: {
8383
default: true
8484
}
8585
})
86-
user = env.users[env.current.user];
86+
const currentEnv = getConfig()?.current?.env;
87+
user = getConfig()?.env?.[currentEnv]?.users?.[getConfig()?.env?.[currentEnv]?.current?.user];
8788
}
8889

8990
return user;

bin/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ yargs(hideBin(process.argv))
4343
.option('apiKey', {
4444
description: 'Allows setting the apiKey for an environmentless execution of the CLI command'
4545
})
46+
.option('oauth', {
47+
type: 'boolean',
48+
description: 'Use OAuth client credentials authentication (shorthand for --auth oauth)'
49+
})
4650
.option('auth', {
4751
choices: ['user', 'oauth'],
4852
description: 'Overrides the authentication mode for the command'

0 commit comments

Comments
 (0)