File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -11,27 +11,28 @@ class ChatTokenGenerator extends TwilioClientCommand {
1111 this . showHeaders = true ;
1212 }
1313
14- validateChatServiceSid ( ) {
14+ validateChatServiceSid ( sid ) {
1515 return (
16- this . flags [ 'chat-service- sid' ] . startsWith ( 'IS' ) &&
17- this . flags [ 'chat-service- sid' ] . length === 34
16+ sid . startsWith ( 'IS' ) &&
17+ sid . length === 34
1818 ) ;
1919 }
2020
2121 async run ( ) {
2222 await super . run ( ) ;
2323
24+ const chatServiceSid = await this . flags [ 'chat-service-sid' ] ;
2425 const accessToken = createToken . call ( this ) ;
2526
26- if ( ! this . validateChatServiceSid ( ) ) {
27+ if ( ! this . validateChatServiceSid ( chatServiceSid ) ) {
2728 this . logger . error (
2829 'Invalid Chat Service SID, must look like ISxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
2930 ) ;
3031 process . exit ( 1 ) ;
3132 }
3233
3334 let chatGrant = new Twilio . jwt . AccessToken . ChatGrant ( {
34- serviceSid : this . flags [ 'chat-service-sid' ] ,
35+ serviceSid : chatServiceSid
3536 } ) ;
3637 accessToken . addGrant ( chatGrant ) ;
3738
You can’t perform that action at this time.
0 commit comments