Unauthorised: Invalid Token
ebrahimpleite opened this issue · 0 comments
ebrahimpleite commented
Expected Behavior
Send message whatsapp
Current Behavior
Unauthorised: Invalid Token
Possible Solution
Steps to Reproduce (for bugs)
This my code:
$basic = new \Vonage\Client\Credentials\Basic(NEXMO_API_KEY, NEXMO_API_SECRET);
$keypair = new \Vonage\Client\Credentials\Keypair(
file_get_contents(__DIR__ . "/../../private.key"),
NEXMO_APP
);
$client = new Vonage\Client(new Vonage\Client\Credentials\Container($keypair, $basic), ['show_deprecations' => false, 'debug' => false], new \GuzzleHttp\Client());
$templateObject = new \Vonage\Messages\MessageObjects\TemplateObject("NAMESPACE:TEMPLATE",[$user]);
$whatsAppTemplate = new \Vonage\Messages\Channel\WhatsApp\WhatsAppTemplate($phone,NEXMO_API_PHONE,$templateObject,"pt-BR");
try {
$client->messages()->send($whatsAppTemplate);
} catch (\Vonage\Client\Exception\Request $e) {
echo $e->getMessage();
}
The private.key file I generated in the panel on this button:
Your Environment
- Version used: dev-main
- Environment: PHP 8.0