Error is from Twilio PHP SDK and not Livewire.
Suggest to recheck SID and Token from your Twilio Dashboard.
More Details: https://stackoverflow.com/questions/38820348/twillio-php-api
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I recently tried to implement phone verification into my app using Twilio, I created a livewire Class with this function: "
public function sendSms(){
$sid = getenv("TWILIO_ACCOUNT_SID");
$token = getenv("TWILIO_AUTH_TOKEN");
$twilio = new Client($sid, $token);
$service = $twilio->verify->v2->services
->create("FriendlyName");
print($service->sid);
}
" just like in the docs. and in the view I created a button to trigger this function and send a verification code to my phone number. "
<div>
<button class="bg-blue-500 px-3 py-3 text-white rounded " wire:click='sendSms()'>Verify</button>
According to the docs this is supposed to work with no issues but every time I fired the event it gives me this error.
[HTTP 401] Unable to create record: Authentication Error - invalid username
Please or to participate in this conversation.