Treat unauthenticated exceptions the same as everything else

This commit is contained in:
Dane Everitt 2018-07-14 22:42:38 -07:00
parent aba1b297c8
commit a7fae86e58
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -231,7 +231,7 @@ class Handler extends ExceptionHandler
protected function unauthenticated($request, AuthenticationException $exception) protected function unauthenticated($request, AuthenticationException $exception)
{ {
if ($request->expectsJson()) { if ($request->expectsJson()) {
return response()->json(['error' => 'Unauthenticated.'], 401); return response()->json(self::convertToArray($exception), 401);
} }
return redirect()->guest(route('auth.login')); return redirect()->guest(route('auth.login'));