lib/Authentication/HeaderTokenAuthenticator.php
public function start(Request $request, AuthenticationException $exception = null)
    {
        if ($exception) {
            $message = $exception->getMessage();
            if (empty($message) && is_callable([$exception, 'getMessageKey'])) {
                $message = $e->getMessageKey();
            }
        } else {
            $message = 'Full authentication is required to access this resource.';
        }

        $content = [
            'errors' => [
                'code' => 401,
                'message' => $this->translator->trans($message, [], 'errors')
            ]
        ];

        return new JsonResponse($content, JsonResponse::HTTP_UNAUTHORIZED);
    }
public function start(Request $request, AuthenticationException $exception = null)
    {
        if ($exception) {
            $message = $exception->getMessage();
            if (empty($message) && is_callable([$exception, 'getMessageKey'])) {
                $message = $e->getMessageKey();
            }
        } else {
            $message = 'Full authentication is required to access this resource.';
        }

        $content = [
            'errors' => [
                'code' => 401,
                'message' => $this->translator->trans($message, [], 'errors')
            ]
        ];

        return new JsonResponse($content, JsonResponse::HTTP_UNAUTHORIZED);
    }
public function start ( Request $ request , AuthenticationException $ exception = null ) { if ( $ exception ) { $ message = $ exception -> getMessage ( ) ; if ( empty ( $ message ) && is_callable ( [ $ exception , 'getMessageKey' ] ) ) { $ message = $ e -> getMessageKey ( ) ; } } else { $ message = 'Full authentication is required to access this resource.' ; } $ content = [ 'errors' => [ 'code' => 401 , 'message' => $ this -> translator -> trans ( $ message , [ ] , 'errors' ) ] ] ; return new JsonResponse ( $ content , JsonResponse :: HTTP_UNAUTHORIZED ) ; }
Called when authentication is needed, but it's not sent or is invalid
Called when authentication is needed but it s not sent or is invalid