Call api return an 500 error (Call to a member function isAdmin())

142 views Asked by At

I'm using lexik_jwt_authentication to make api calls to symfony. I made the call to login and I get the token so all good at this level. Now when I tried to make a call to another api whith this token I get the error : Call to a member function isAdmin() on null (500 Internal Server Error). My api :

/**
     * @Route("/vsbridge/product/get/{product}")
     * @Method("GET")
     *
     * @param Request           $request
     *
     * @return JsonResponse
     */
    public function getProduct(
        Request $request
    ) {
        $user = $this->getUser();

        return $this->json([
            'status' => 200,
            'result' => $user,
        ]);
    }

Have you an idea ? Thx in advance.

0

There are 0 answers