Api call by jwt does not work-> code is added

trying to make the flow of requests through jwt , (internal library in the helpers ), I did not know how to authenticate the calls with jwt , reviewing the code I realized that there was no code for that section,

To validate the code in the header, add the following code in
modules/App/api.php line 58

// is jwt token?
    } elseif ($token != 'public' && preg_match('/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/', $token)) {

            //  TODO
            $user = $this->helper('jwt')->decode($token);
            
            if (!$user) {
                $this->response->status = 412;
                return ['error' => 'Authentication failed'];
            }

            //add logica de jwt
            $apiUser['user'] = $user->user;
            $apiUser['role'] = $user->role;
                   

    } else {