attributes->get('_route'); if ($authException instanceof InsufficientAuthenticationException && u($route)->startsWith('_api_')) { throw new UnauthorizedHttpException('', $authException->getMessage(), $authException); } return new RedirectResponse($this->urlGenerator->generate('app_login')); } }