class MY_Controller extends CI_Controller { protected $skipAuth = false; protected $user = null; public function __construct() { parent::__construct(); header('Content-Type: application/json'); if (!$this->skipAuth) { $this->authorize(); } } private function authorize() { try { $this->user = verify_jwt(); // from helper } catch (Exception $e) { echo json_encode([ "status" => 0, "message" => "Unauthorized", "error" => $e->getMessage() // optional (remove in prod) ]); exit; } } }
We Are Sorry
Your IP is not authorized to access this system.