Closed dwightwatson closed 1 year ago
What I'm doing to do here is paste in my API key and secret directly into this code and make the call - if it's successful I can attribute this to config()
helpers in Laravel and is definitely not an issue with the SDK. If it does still complain, I should be able to find the root cause.
Just tested using the values directly (without the config()
helper) and had the same result. Are you able to replicate it on your end?
I've managed to replicate it, I think it's a bug where it needs to use a new auth handler I wrote recently. Fix should be incoming shortly.
Actually this might be a slightly bigger bug regarding auth than I thought due to how IterableApiCollection
works. Will update after finding out more.
PR open #379
Merged, thanks for reporting!
Thanks for taking the time to get to the bottom of this!
@SecondeJK could you please double-check that the sample code works for you after this fix?
I've upgraded to vonage/client-core
4.0.8 and I'm experiencing the same issue.
Huh. Guess I need to write a more stringent test for it
Argh. An easy one line fix, what a pain. I'll get a PR open for it.
@SecondeJK Same trouble in Vonage\Numbers\ClientFactory
public function __invoke(ContainerInterface $container): Client
{
/** @var APIResource $api */
$api = $container->make(APIResource::class);
$api
->setBaseUrl($api->getClient()->getRestUrl())
->setIsHAL(false)
->setAuthHandler(new BasicHandler());
return new Client($api);
}
need setAuthHandler(new BasicQueryHandler());
I'm glad I wrote that new AuthHandler! This will go out with another PR that handles some SMS behaviour next week.
This should now be fixed with 4.0.10 - please reopen if you still have issues
I'm attempting to use the number insights API. When I use it through the PHP client I get an exception
Error: Invalid credentials
. However when using these exact same credentials in a regular HTTP request it works fine.Here is it using the PHP client - I can't see where I have made a mistake in this code:
And here it is using Laravel's HTTP client - a very basic request with the same credentials:
This seems somewhat related to #373 but I can't pinpoint how (especially as that seemed to resolve itself). Happy to provide all user account and testing details in private if you have trouble replicating on your end.
(I have actually been able to replicate this with two entirely separate sets of Vonage credentials).
Expected Behavior
I would expect the insights API to return a response object. This used to work on v3 and only appears to have cropped up since upgrading to v4.
If there is another error I'd expect that to balloon up instead of an authentication error.
Current Behavior
And exception
Vonage\Client\Exception\Request Error: Invalid credentials.
is thrown as a result of calling the insights API.