I am trying to paginate the records for Twilio and after taking the reference from here
I have added the next page and previous page url and its showing successfully but when I am opening the url, its showing the error i.e.
"code": 20003,
"detail": "Your AccountSid or AuthToken was incorrect.",
"message": "Authentication Error - No credentials provided",
"more_info": "https://www.twilio.com/docs/errors/20003",
"status": 401
Here is my code :
public function listcallsapp(Request $request){
$calls = $this->twilio->calls->page([], 50);
$data = [];
$i = 0;
foreach($calls as $call){
$data[$i]['sid'] = $call->sid;
$data[$i]['from'] = $call->from;
$data[$i]['to'] = $call->to;
$data[$i]['direction'] = $call->direction;
$data[$i]['status'] = $call->status;
$data[$i]['duration'] = $call->duration;
$i++;
}
return response()->json([
'message'=>'Call Logs!',
'code'=>200,
'prev' => $calls->getPreviousPageUrl(),
'next' => $calls->getNextPageUrl(),
'data'=>$data,
'status'=>'success'
]);
}
Where I am missing, please help me out. Also, If any other way, please suggest.