• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
auth_override_class_method_http not working with HMVC

#1
Hi I have a config setting like below:

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

I am using this library for my HMVC: https://bitbucket.org/wiredesignz/codeig...sions-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:
Code:
<?php
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
        parent::__construct();

        $this->load->model('Auth_model', 'Entity_model');
        //$this->load->library('form_validation');
        $this->load->library('validation');

        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 https://i.vgy.me/APy9PT.png */


            $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]
Reply

#2
You would need to also make the rest controller use HMVC.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.