Skip to content

Commit 8562089

Browse files
Update flex
1 parent 420128c commit 8562089

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/commands/token/flex.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,27 @@ class FlexTokenGenerator extends TwilioClientCommand {
1515
async run() {
1616
await super.run();
1717

18+
const workerSid = await this.flags['worker-sid'];
19+
const workspaceSid = await this.flags['workspace-sid'];
1820
const accessToken = createToken.call(this);
1921

20-
if (!validateWorkerSid(this.flags['worker-sid'])) {
22+
if (!validateWorkerSid(workerSid)) {
2123
this.logger.error(
2224
'Invalid Worker SID, must look like WKxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
2325
);
2426
process.exit(1);
2527
}
2628

27-
if (!validateWorkspaceSid(this.flags['workspace-sid'])) {
29+
if (!validateWorkspaceSid(workspaceSid)) {
2830
this.logger.error(
2931
'Invalid Workspace SID, must look like WSxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
3032
);
3133
process.exit(1);
3234
}
3335

3436
let flexGrant = new Twilio.jwt.AccessToken.TaskRouterGrant({
35-
workerSid: this.flags['worker-sid'],
36-
workspaceSid: this.flags['workspace-sid'],
37+
workerSid,
38+
workspaceSid,
3739
role: 'worker'
3840
});
3941
accessToken.addGrant(flexGrant);

0 commit comments

Comments
 (0)