Čamo
Čamo

Reputation: 4160

Codeigniter 3 + Tank auth throws error: Unknown column 'data' in 'field list'

Can you help me please with authentication in Codeigniter? I start with CI yesterday so I am little confused. I found Tank auth library, but it seems it is not compatible with CI3. It throws me an error: "Unknown column 'data' in 'field list'" from libraries/Session/drivers/Session_database_driver.php Session library expects the field name data in ci_session table. My ci_session table comes from Tank auth download and there is user_data field instead. What can I do? Or is there a better authentication library for CI3? I wolud like to find lib with authentication + authorisation.

Upvotes: 0

Views: 1589

Answers (1)

GluePear
GluePear

Reputation: 7715

Late answer, but it might be useful to someone. To get Tank Auth working in Codeigniter 3:

In config.php, remove the options which are no longer in the new default config.php, and add the ones specified in the upgrade guide.

Set sess_driver to files:

$config['sess_driver'] = 'files';

And add an absolute path to the sess_save_path option:

$config['sess_save_path']   = BASEPATH . 'sessions';

In the Auth controller, remove $this->load->library('security'); this is because the security library is loaded automatically.

In the same controller, add $this->load->helper('security'); -- this allows the XSS clean method which is used in Tank Auth's default controller. You might as well also remove xss_clean from the validation rules in the Auth controller - these are now obsolete. See this this Stack Overflow question.

All this is of course assuming that the rest of the instructions in the upgrade guide have been followed.

Upvotes: 0

Related Questions