Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

twilio token:voice --identity=alice --voice-app-sid=AP40f04d5c678c9fd3a3b5add1724395e8 -l debug #61

Open
Gangadhar1806 opened this issue Apr 10, 2024 · 2 comments

Comments

@Gangadhar1806
Copy link

Error is

[DEBUG] Config File: /Users/ganga.k/.twilio-cli/config.json
[DEBUG] Using profile: Twilio_Staging_Mobile
[DEBUG] Found command "token:voice" plugin: @twilio-labs/plugin-token
» twilio-cli encountered an unexpected error. To report this issue, execute the command with the "-l debug" flag, then copy the output to a new issue here: "https://github.com/twilio-labs/plugin-token/issues"
[DEBUG] identity is required to be specified in options
[DEBUG] Error: identity is required to be specified in options
at new AccessToken (/Users/ganga.k/.twilio-cli/node_modules/twilio/lib/jwt/AccessToken.js:28:19)
at VoiceTokenGenerator.createToken (/Users/ganga.k/.twilio-cli/node_modules/@twilio-labs/plugin-token/src/helpers/accessToken.js:14:23)
at VoiceTokenGenerator.run (/Users/ganga.k/.twilio-cli/node_modules/@twilio-labs/plugin-token/src/commands/token/voice.js:17:37)
at async VoiceTokenGenerator._run (/Users/ganga.k/.twilio-cli/node_modules/@oclif/command/lib/command.js:43:20)
at async Config.runCommand (/Users/ganga.k/.npm-global/lib/node_modules/twilio-cli/node_modules/@oclif/core/lib/config/config.js:301:25)
› Error: EEXIT: 1
› Code: EEXIT

@yigitcan-dh
Copy link

I had the same error following the quickstart guide for the ios application. Seems like this CLI plugin is outdated and is misusing the Twilio lib's JWT access token generation.

Changing the ~/.twilio-cli/node_modules/@twilio-labs/plugin-token/src/helpers/accessToken.js file

From:

const accessToken = new Twilio.jwt.AccessToken(
  this.twilioClient.accountSid,
  this.twilioClient.username,
  this.twilioClient.password
);

To:

const accessToken = new Twilio.jwt.AccessToken(
  this.twilioClient.accountSid,
  this.twilioClient.username,
  this.twilioClient.password,
  { identity: this.flags.identity }
);

fixes it.

@CongLeSolutionX
Copy link

I had the same error following the quickstart guide for the ios application. Seems like this CLI plugin is outdated and is misusing the Twilio lib's JWT access token generation.

Changing the ~/.twilio-cli/node_modules/@twilio-labs/plugin-token/src/helpers/accessToken.js file

From:

const accessToken = new Twilio.jwt.AccessToken(
  this.twilioClient.accountSid,
  this.twilioClient.username,
  this.twilioClient.password
);

To:

const accessToken = new Twilio.jwt.AccessToken(
  this.twilioClient.accountSid,
  this.twilioClient.username,
  this.twilioClient.password,
  { identity: this.flags.identity }
);

fixes it.

This also worked for me! Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants