Welcome Guest, Not a member yet? Register   Sign In
Multi login in codeignter
#5

(09-14-2015, 08:18 AM)mwhitney Wrote: Essentially, you keep the data required to perform authentication separate from the user information and use a foreign key to link the user data to the authentication data. Then, once the user is logged in with one authentication method, you can allow them to associate other authentication methods with their account, so they can log in using whichever method they wish. For example, you might have a user table and your PHP authentication table look something like this:


Code:
user {
 id unsigned bigint(20) auto_increment not null,
 display_name varchar(255) not null,
 contact_email varchar(255) not null
}

php_auth {
 login_email varchar(255) not null,
 password varchar(255) not null,
 user_id unsigned bigint(20) not null
}

facebook_auth {
 facebook_id unsigned bigint(20) not null,
 // any other data needed for facebook
 user_id unsigned bigint(20) not null
}

So, when a user creates a new account, you would insert their user information in the user table, get the inserted ID, then create the entry in the appropriate *_auth table, using the inserted ID from the user table as the user_id in the *_auth table(s). If they want to add an additional authentication method to their existing account, you authenticate them and insert their user ID and other relevant information into the appropriate *_auth table.

When they log in, you look up their information in the *_auth table appropriate to the method they used to log in, then use the user_id to get their account info. If they log in with Facebook or Twitter and don't have an entry in the *_auth table, you can let them know that you've created a new account using the information you retrieved from Facebook/Twitter, and give them the opportunity to instead associate their Facebook/Twitter login with an existing account, if they can authenticate with whatever authentication method was previously used on that account.

thanks a lot mwhitney but it seems hard to applicated it, do you have simple tutorial or demo about it, need one day to get know login using facebook without insert data users to databse, it will spend more time for me. if is there any tutorial please drop here uncle need some help and advice, thanks for you advice will try it after know how to get data users from twitter also facebook, 
Reply


Messages In This Thread
Multi login in codeignter - by freddy - 09-12-2015, 01:34 AM
RE: Multi login in codeignter - by includebeer - 09-12-2015, 12:26 PM
RE: Multi login in codeignter - by freddy - 09-14-2015, 07:29 PM
RE: Multi login in codeignter - by includebeer - 09-15-2015, 04:24 PM
RE: Multi login in codeignter - by freddy - 09-15-2015, 07:35 PM
RE: Multi login in codeignter - by includebeer - 09-16-2015, 04:53 AM
RE: Multi login in codeignter - by freddy - 09-16-2015, 06:56 PM
RE: Multi login in codeignter - by includebeer - 09-21-2015, 04:03 PM
RE: Multi login in codeignter - by freddy - 10-02-2015, 08:57 PM
RE: Multi login in codeignter - by mwhitney - 09-14-2015, 08:18 AM
RE: Multi login in codeignter - by freddy - 09-14-2015, 07:31 PM
RE: Multi login in codeignter - by mwhitney - 09-16-2015, 09:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB