Using Ion Auth as a separate module in the HMVC structure

Gayan Hewa picture Gayan Hewa · Jun 15, 2011 · Viewed 12.8k times · Source

I am interested in using ion auth for a project of mine which is running on the HMVC pattern. The application is written in Codeigniter.

The problem I face is once the ion auth is placed in the /app/modules/auth folder, when I try to access the module I get the below error:

HTTP Error 500 (Internal Server Error):
An unexpected condition was encountered while the server was attempting to fulfill the request.

Please help me out here, I am sure that I am having some sort of a configuration/path problem but just can't figure out where.

I have simply downloaded the ion_auth files from github and placed the extracted files as it is in the module folder I removed all the lines where it loads the libraries such as database, session since I have used the config to auto load them. But I left the loading of the ion_auth library.

In the module folder modules/auth I have a similar application structure with the module specific config, libraries, etc folders.

Let me know where I must have done wrong, I will continue to search and fix this problem and post if I have any luck.

Answer

ciuser picture ciuser · Aug 9, 2011

Try this:

  1. Get: codeigniter.zip (CI2.0)
  2. Extract, make sure it is running, set config/config.php
  3. Get Modular Extension : HMVC
  4. Install - Copy MY_Loader & MY_Router to /core, MX to third party folder Do not copy MY_Controller - this is for Modular Separation and not Extensions
  5. Get Ion_auth
  6. Install the SQL for the Ion_auth
  7. Put Ion_auth into a modules folder /application/modules/users
  8. Add route in config/routes.php : $route['auth/(.*)'] = 'users/auth/$1';

  9. Autoload ion_auth - $autoload['libraries'] = array('database','session','users/ion_auth');

  10. Edit following paths in modules/users/library/ion_auth.php :

    $this->ci->load->config('users/ion_auth', TRUE);
    $this->ci->load->library('email');
    $this->ci->load->library('session');
    $this->ci->lang->load('users/ion_auth');
    $this->ci->load->model('users/ion_auth_model');