Commit 51addd6c authored by Taylor Otwell's avatar Taylor Otwell Committed by GitHub

Merge pull request #3817 from JosephSilber/unauthenticated-json

[5.3] Return JSON for unauthenticated AJAX requests
parents bd358bdc 8e7672fc
......@@ -56,7 +56,7 @@ class Handler extends ExceptionHandler
protected function unauthenticated($request, AuthenticationException $e)
{
if ($request->ajax() || $request->wantsJson()) {
return response('Unauthorized.', 401);
return response()->json(['error' => 'Unauthenticated.'], 401);
} else {
return redirect()->guest('login');
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment