更改护照上的Json回复

时间:2019-04-25 16:11:51

标签: laravel laravel-passport

能否请您告诉我如何更改JSON响应以使用错误的api令牌进行请求。

我的意思是

{
    "error": true,
    "message": "Unauthenticated.",

}

我想这样做

    editcap -t 14272376 capture1.pcap capture1-shifted.pcap
    editcap -t 14272376 capture2.pcap capture2-shifted.pcap     
    mergecap -w merged.pcap capture1-shifted.pcap capture2-shifted.pcap

该在哪里更改?谢谢

1 个答案:

答案 0 :(得分:2)

项目的app/Exceptions/Handler.php文件中有一个名为render()的函数。在该函数内添加以下代码块:

if($exception instanceof \Illuminate\Auth\AuthenticationException){
  return response()->json(['error' => true, 'message' => 'Unauthenticated.'], 401);
}
相关问题