Multi login in codeignter |
Hello guys thanks for answering questions few days ago, i have system multi ( register, login and logout ) using facebook, twitter, (manual input type information users )
here is my table --> id_user, email, name, password (only thi field is important) i have success
what i have not create
My question
this system need the id from users so it give me blank idea firt time IF you guys have experience about this please share something idea to me as new bie especially Codeignter 3
Check out the A3M project. They do exactly that. There's a way to link your account to your facebook or twitter account so you can log with any method available.
https://github.com/donjakobo/A3M
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
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 { 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. (09-12-2015, 12:26 PM)includebeer Wrote: Check out the A3M project. They do exactly that. There's a way to link your account to your facebook or twitter account so you can log with any method available. Than for respon i just saw an dlearn it yesterday but hard to understand it, is there any tutorial you had about this issue login media social and get the id_user (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: 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,
(09-14-2015, 07:29 PM)freddy Wrote:(09-12-2015, 12:26 PM)includebeer Wrote: Check out the A3M project. They do exactly that. There's a way to link your account to your facebook or twitter account so you can log with any method available. I don't have any tutorial but you can study the code. You have a working example, that's the best tutorial you can get!
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
09-15-2015, 07:35 PM
(This post was last modified: 09-15-2015, 08:34 PM by freddy. Edit Reason: edit for testing file in github ) (09-15-2015, 04:24 PM)includebeer Wrote:do you have any experience about this issue includebeer ? the link you have given to me is it avaiable for codeignter 3 ?(09-14-2015, 07:29 PM)freddy Wrote:(09-12-2015, 12:26 PM)includebeer Wrote: Check out the A3M project. They do exactly that. There's a way to link your account to your facebook or twitter account so you can log with any method available. i have been testing your link above but i don't ghet the point how to register users and get in the login
(09-15-2015, 07:35 PM)freddy Wrote: do you have any experience about this issue includebeer ? the link you have given to me is it avaiable for codeignter 3 ? Like mwhitney explained, you have to link all the login method to one user database. That way, the users can use any method available to log in. Install A3M on a test site, you will see in your profile page a way to link your facebook or twitter account to the same user. Then you can use one way or the other to login and you won't have duplicate user. And yes it's available for CI3, just change the branch for ci3-beta : https://github.com/donjakobo/A3M/tree/ci3-beta
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
As includebeer pointed out, the A3M code is probably the best we can do for you. In most cases the biggest step in going from a single authentication method to multiple methods is to move the fields currently required for authentication out of your users table. Once you've put them in a separate table with a user_id foreign key to look up the user information, it's relatively simple to add additional methods of authentication. The hardest part at that point is figuring out how to do something specific like Facebook authentication, and you can probably find tutorials for each form of authentication you need to support, you'll just have to rework them for your specific needs.
(09-16-2015, 04:53 AM)includebeer Wrote:(09-15-2015, 07:35 PM)freddy Wrote: do you have any experience about this issue includebeer ? the link you have given to me is it avaiable for codeignter 3 ? yes i do design my database like mwhtiney said above then i have download and test it in my localhost but the first time i register my self then change the status from database and log in to system but there is no menu to make my account register to facebook or twitter, only has menu for profile, change the password and connect link to the account (not found i don't know why because i just fixed my htacsess to make it running). Connect link to the account is it for connect my account to media social ? all i do in my htacsess from the oribinal file just remove this line RewriteBase / if not remove it it give me redirect to http://localhost/xampp/splash.php i use windows Code: RewriteEngine On my question
|
Welcome Guest, Not a member yet? Register Sign In |