diff --git a/src/Subfission/Cas/Middleware/CASAuth.php b/src/Subfission/Cas/Middleware/CASAuth.php index 6bb70c7..b66cfda 100644 --- a/src/Subfission/Cas/Middleware/CASAuth.php +++ b/src/Subfission/Cas/Middleware/CASAuth.php @@ -29,7 +29,7 @@ public function handle($request, Closure $next) // Store the user credentials in a Laravel managed session session()->put('cas_user', $this->cas->user()); } else { - if ($request->ajax()) { + if ($request->ajax() || $request->wantsJson()) { return response('Unauthorized.', 401); } $this->cas->authenticate();