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

[BUG] tokenWillExpire does not emit after updating the token #329

Closed
4 tasks
skeithtan opened this issue Nov 30, 2023 · 3 comments
Closed
4 tasks

[BUG] tokenWillExpire does not emit after updating the token #329

skeithtan opened this issue Nov 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@skeithtan
Copy link

The tokenWillExpire event emits when the initial token will expire (the token set here: const device = new Device(token, {...});)

After updating the device's token, tokenWillExpire no longer emits.

Set the server to issue tokens (short lived for debugging purposes):

// Server
const token = new AccessToken(accountSid, apiKey, apiSecret, {
    identity: "something",
    ttl: 20, // Short lived, 20 seconds to expiration
  });

return token.toJwt();
// Client
device.on('tokenWillExpire', async (device: Device) => {
  const token = await fetch(....); // Fetch from the server
  device.updateToken(token); // Works, but then it never emits `tokenWillExpire` ever again
});
  • Browser(s): Firefox
  • Operating System: macOS
  • twilio.js: 2.9.0
  • Third-party libraries (e.g., Angular, React, etc.): React
@skeithtan skeithtan added the bug Something isn't working label Nov 30, 2023
@charliesantos
Copy link
Contributor

@skeithtan is this the same issue as described here twilio/twilio-voice.js#93?

@skeithtan
Copy link
Author

@charliesantos Yes, it looks like it's the very same one

@charliesantos
Copy link
Contributor

@skeithtan thanks. I'll close this one now. Please use twilio/twilio-voice.js#93 for tracking instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants