Vonage / vonage-python-sdk

Vonage Server SDK for Python. API support for Voice, SMS, WhatsApp, Verify (2FA), Video Meetings and more.
https://developer.vonage.com
Apache License 2.0
193 stars 118 forks source link

Client becomes unauthorized after 15m #303

Closed Roedy13 closed 3 months ago

Roedy13 commented 4 months ago

I'm creating a client with a private key and application ID. Instead of a creating a new client for each message, the client object is reused. I added print statements into the code and verified that for every request, a new JWT is generated with a new JTI, ITA, and EXP. After 15 minutes, sending a message errors out with an Authorization Error. I noticed that the expiration time of the JWT is 15 minutes, but since the client is generating a new JWT for each request, I did not expect an authorization error.

Expected Behavior

The authorization should not fail after 15 minutes

Possible Solution

A workaround is to create a new client object for each request.

Steps to Reproduce (for bugs)

  1. Create a client
  2. send a message
  3. wait for at least 15 minutes
  4. send another message with the same client

Context

Just trying to send a message

Your Environment

maxkahan commented 4 months ago

Hi, unsure why you're seeing this behaviour. The Vonage JWT library sets a default expiry time from the iat time set every time the method is called. Can you provide a code example so I can reproduce the issue?

maxkahan commented 3 months ago

Closing as no activity