Passportのトークンエラーもここを書き換えれば変更されました。
とある基盤に合わせるため、 ヘッダも変更しています。
vi {laravel_home}/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php
protected function unauthenticatedを以下のように書き換え
php
1 protected function unauthenticated($request, AuthenticationException $exception)
2 {
3 if ($request->expectsJson()) {
4 $response = "{ \"errors\": [ { \"message\": \"Unauthenticated!\" } ] }";
5 return response($response, 401)
6 ->header('Content-Type', 'application/json;charset=UTF-8');
7 }
8 return redirect()->guest('login');
9 }
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。