@@ -10,11 +10,11 @@ export default class RevokeTokenCommand extends AblyBaseCommand {
1010 static description = "Revoke tokens by client ID or revocation key" ;
1111
1212 static examples = [
13- " $ ably auth revoke-token --client-id user@example.com" ,
14- " $ ably auth revoke-token --client-id user@example.com --force" ,
15- " $ ably auth revoke-token --revocation-key group1" ,
16- " $ ably auth revoke-token --client-id user@example.com --allow-reauth-margin" ,
17- " $ ably auth revoke-token --client-id user@example.com --json --force" ,
13+ ` $ ably auth revoke-token --client-id "userClientId"` ,
14+ ` $ ably auth revoke-token --client-id "userClientId" --force` ,
15+ ` $ ably auth revoke-token --revocation-key group1` ,
16+ ` $ ably auth revoke-token --client-id "userClientId" --allow-reauth-margin` ,
17+ ` $ ably auth revoke-token --client-id "userClientId" --json --force` ,
1818 ] ;
1919
2020 static flags = {
@@ -38,7 +38,7 @@ export default class RevokeTokenCommand extends AblyBaseCommand {
3838 "allow-reauth-margin" : Flags . boolean ( {
3939 default : false ,
4040 description :
41- "Delay enforcement by 30s so connected clients can obtain a new token before disconnection" ,
41+ "[default: false] Delay enforcement by 30s so connected clients can obtain a new token before disconnection. " ,
4242 } ) ,
4343 } ;
4444
@@ -64,15 +64,7 @@ export default class RevokeTokenCommand extends AblyBaseCommand {
6464 const targetLabel = clientId ? "Client ID" : "Revocation Key" ;
6565 const targetValue = ( clientId ?? revocationKey ) ! ;
6666
67- // Get app and key
68- const appAndKey = await this . ensureAppAndKey ( flags ) ;
69- if ( ! appAndKey ) {
70- return ;
71- }
72-
73- const { apiKey } = appAndKey ;
74-
75- // JSON mode guard
67+ // JSON mode guard — fail fast before config lookup
7668 if ( ! flags . force && this . shouldOutputJson ( flags ) ) {
7769 this . fail (
7870 "The --force flag is required when using --json to confirm revocation" ,
@@ -81,10 +73,20 @@ export default class RevokeTokenCommand extends AblyBaseCommand {
8173 ) ;
8274 }
8375
76+ // Get app and key
77+ const appAndKey = await this . ensureAppAndKey ( flags ) ;
78+ if ( ! appAndKey ) {
79+ return ;
80+ }
81+
82+ const { apiKey } = appAndKey ;
83+
8484 // Interactive confirmation
8585 if ( ! flags . force && ! this . shouldOutputJson ( flags ) ) {
86- this . log ( `\nYou are about to revoke all tokens matching:` ) ;
87- this . log ( `${ formatLabel ( targetLabel ) } ${ formatResource ( targetValue ) } ` ) ;
86+ this . logToStderr ( `\nYou are about to revoke all tokens matching:` ) ;
87+ this . logToStderr (
88+ `${ formatLabel ( targetLabel ) } ${ formatResource ( targetValue ) } ` ,
89+ ) ;
8890
8991 const confirmed = await promptForConfirmation (
9092 "\nThis will permanently revoke all matching tokens, and any applications using those tokens will need to be issued new tokens. Are you sure?" ,
0 commit comments