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
194 stars 118 forks source link

Api key-secret auth -> 'Auth' object has no attribute '_jwt_client' #308

Open manakov-dev opened 1 week ago

manakov-dev commented 1 week ago

vonage==4.0.0 Unable to auth with API key and API secret

Expected Behavior

Sending sms

Current Behavior

code raising AttributeError: 'Auth' object has no attribute '_jwt_client'

Possible Solution

Steps to Reproduce (for bugs)

from vonage import Auth, Vonage

client = Vonage(
    Auth(
        api_key='******',
        api_secret='******'
    )
)

message = Sms(
    to='****',
    from_='****',
    text='Hello world',
)
response = client.messages.send(message)

Context

messages.send internally calls self._http_client.post without auth_type parameter, so it defaults to 'jwt' instead of 'body'

Your Environment

maxkahan commented 1 week ago

Hi @manakov-dev thanks for getting in touch. Originally we wanted to support only JWT authentication for the Messages API, but as customers are still using key-secret auth I'll release a new version that adds support for this.

Note that you won't be able to use webhook features, e.g. receiving inbound messages, whilst using key-secret header auth.

manakov-dev commented 6 days ago

Sounds great! Thanks!