Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Yousarssif's avatar

Got a [HTTP 401] Unable to create record: Authentication Error

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

0 likes
1 reply

Please or to participate in this conversation.