-
kwat3173
Newbie
-
Posts: 6
Threads: 1
Joined: May 2017
Reputation:
0
Let me say first that I think there is alot of potential for this addon. However after creating the user you can't login by going to examples/index. Instead you get the following error message:
A Database Error Occurred
Error Number: 1048
Column 'id' cannot be null
INSERT INTO `auth_sessions` (`id`, `user_id`, `login_time`, `ip_address`, `user_agent`) VALUES (NULL, '196742049', '2017-05-21 23:32:40', '::1', 'Chrome 58.0. on Windows 10')
Filename: C:/wamp64/www/auth/system/database/DB_driver.php
Line Number: 691
To me it seems that its trying to insert NULL in the id field of the auth_sessions table and NULL can not be there.
(database fields)
id user_id login_time ip_address user_agent
-----------------------------------------------------------------------------------------
NULL 196742049 2017-05-21 23:32:40 ::1 Chrome 58.0. on Windows 10
-
kwat3173
Newbie
-
Posts: 6
Threads: 1
Joined: May 2017
Reputation:
0
(05-22-2017, 07:50 AM)skunkbad Wrote: What is your session config look like? Have you set base_url in config/config? Did you properly set up your encryption key?
I set the base_url in config. Used the key creator script for the encryption. My sessions i set to
Database
Save path ci_sessions
Then i tried
Database
Save path auth_sessions
But still got the same error.
-
skunkbad
Senior Citizen
-
Posts: 1,300
Threads: 63
Joined: Oct 2014
Reputation:
86
(05-22-2017, 11:27 AM)kwat3173 Wrote: (05-22-2017, 07:50 AM)skunkbad Wrote: What is your session config look like? Have you set base_url in config/config? Did you properly set up your encryption key?
I set the base_url in config. Used the key creator script for the encryption. My sessions i set to
Database
Save path ci_sessions
Then i tried
Database
Save path auth_sessions
But still got the same error.
To ensure that this is not a CI config problem, switch your save path back to ci_sessions, then do a simple test to see if sessions are working. If sessions are working, then there could be a problem with Community Auth, but we won't know until you can prove that sessions are working.
There has almost never been a time when Community Auth had a problem that wasn't related to install or config. If after doing your own debugging you still need help, you'll want to create a dump of your mysql database, and include it with a zip of your website. You can make this available to me on Google drive, dropbox, or anywhere else I can download it. I'm a busy guy, but if you give me a couple days, I'll tell you what you did wrong.
-
kwat3173
Newbie
-
Posts: 6
Threads: 1
Joined: May 2017
Reputation:
0
(05-22-2017, 01:28 PM)skunkbad Wrote: (05-22-2017, 11:27 AM)kwat3173 Wrote: (05-22-2017, 07:50 AM)skunkbad Wrote: What is your session config look like? Have you set base_url in config/config? Did you properly set up your encryption key?
I set the base_url in config. Used the key creator script for the encryption. My sessions i set to
Database
Save path ci_sessions
Then i tried
Database
Save path auth_sessions
But still got the same error.
To ensure that this is not a CI config problem, switch your save path back to ci_sessions, then do a simple test to see if sessions are working. If sessions are working, then there could be a problem with Community Auth, but we won't know until you can prove that sessions are working.
There has almost never been a time when Community Auth had a problem that wasn't related to install or config. If after doing your own debugging you still need help, you'll want to create a dump of your mysql database, and include it with a zip of your website. You can make this available to me on Google drive, dropbox, or anywhere else I can download it. I'm a busy guy, but if you give me a couple days, I'll tell you what you did wrong.
I got it to work. The issue was indeed with my ci_sessions.
I created the table using:
CREATE TABLE IF NOT EXISTS `ci_sessions` (
`id` varchar(128) NOT NULL,
`ip_address` varchar(45) NOT NULL,
`timestamp` int(10) unsigned DEFAULT 0 NOT NULL,
`data` blob NOT NULL,
KEY `ci_sessions_timestamp` (`timestamp`)
);
But I didn't do the following:
You will also need to add a PRIMARY KEY depending on your ‘sess_match_ip’ setting. The examples below work both on MySQL
// When sess_match_ip = TRUE
ALTER TABLE ci_sessions ADD PRIMARY KEY (id, ip_address);
// When sess_match_ip = FALSE
ALTER TABLE ci_sessions ADD PRIMARY KEY (id);
// To drop a previously created primary key (use when changing the setting)
ALTER TABLE ci_sessions DROP PRIMARY KEY;
Now everything is working! YAY!
-
skunkbad
Senior Citizen
-
Posts: 1,300
Threads: 63
Joined: Oct 2014
Reputation:
86
|