protected function auth($api_only = false)
 {
     $headers = $this->input->request_headers();
     $api_key = array_key_exists('API_KEY', $headers) ? $headers['API_KEY'] : '';
     if ($api_key != API_KEY) {
         $this->response('Forbidden', 403);
     }
     if (!$api_only) {
         $token = array_key_exists('TOKEN', $headers) ? $headers['TOKEN'] : '';
         $user = $this->users_model->check_token($token);
         if (!$user) {
             $this->response('Authorization Error', 401);
         }
         $this->user_id = $user['id'];
         $this->user = $user;
     }
 }