CodeIgniter Forums

Full Version: auth_override_class_method_http not working with HMVC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi I have a config setting like below:

$config['auth_override_class_method_http']['admin']['auth']['post'] = 'none';

I am using this library for my HMVC:

But when I checked with error handling on REST_Controller.php

it seems like /admin/auth is not recognised with REST

here is my REST code:
use Restserver\Libraries\REST_Controller;
defined('BASEPATH') OR exit('No direct script access allowed');
// This can be removed if you use __autoload() in config.php OR use Modular Extensions
/** @noinspection PhpIncludeInspection */
//To Solve File REST_Controller not found
require APPPATH . 'libraries/REST_Controller.php';
require APPPATH . 'libraries/Format.php';

class Auth extends REST_Controller {

    function __construct()
        // Construct the parent class

        $this->load->model('Auth_model', 'Entity_model');

        header('Access-Control-Allow-Origin: *');
        header("Access-Control-Allow-Methods: GET, POST, OPTIONS, PUT, DELETE");


    public function index_get()

      $return_message = [
                         'error' => 102,  
                         'message' => "Entity Not Found"
      $this->set_response($return_message, REST_Controller::HTTP_NOT_FOUND);  


    public function index_post()
        /* Request, Response */

            $message = [
                'status' => true,
                'error_code' => 102,  
                'error_message' => 'success'

            $this->set_response($message, REST_Controller::HTTP_CREATED);
            // CREATED (201) being the HTTP response code



Although all of my GET/POST requests are working fine as it should be on the endpoint.

Could anyone suggest what I should do in order to get it working i.e.,

I want to use authentication on several API request but not on admin/auth [POST]
You would need to also make the rest controller use HMVC.