Vonage / vonage-php-sdk-core

Vonage REST API client for PHP. API support for SMS, Voice, Text-to-Speech, Numbers, Verify (2FA) and more.
https://developer.vonage.com/
Apache License 2.0
916 stars 180 forks source link

"authentication failed" for /account/get-balance #368

Closed codegain closed 1 year ago

codegain commented 1 year ago

Expected Behavior

Authentication against https://rest.nexmo.com/account/get-balance works

Current Behavior

"authentication failed" error after upgrading from 3.1.6 to 4.0.0

Possible Solution

None

Steps to Reproduce (for bugs)

  1. Use 4.0.0 or the latest version (4.0.6)
  2. Call Vonage\Client->accounts()->getBalance()
  3. This results in a request made to https://rest.nexmo.com/account/get-balance with an Authorization Basic Header which does use the correct api_key + api_secret
  4. Check the response: HTTP 401 - authentication failed
  5. Downgrade to 3.1.6
  6. Response OK, no http error

Context

Will stick to 3.1.6 for the moment. Its the second time this call fails for me after upgrading to a new major version (see #243). This may affect other endpoints under /account as well, at least in my case they aren't working.

Your Environment

SecondeJK commented 1 year ago

This is happening because there is only one type of BasicAuth handler, which creates a bearer token. Under the hood, it needs one for older APIs (like this one) that still send the api key and secret as query parameters.

There will be a pretty quick turnaround for this issue, thank you for reporting.

SecondeJK commented 1 year ago

Fixed, thank you for reporting!

codegain commented 1 year ago

@SecondeJK Tested the newest release and works for me! Thank you.