![]() |
Facebook and Standard Codeigniter Login - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Facebook and Standard Codeigniter Login (/showthread.php?tid=51193) |
Facebook and Standard Codeigniter Login - El Forum - 04-24-2012 [eluser]Keylocker[/eluser] Here's the deal: I have my CI 2 application that has its user table with pretty much standard data: Code: user_id As you can see, a user can login with the standard login form (email/password) or connecting with Facebook. My problem is that, 1) If a user has got a standard account on the site and the next time he logins with Facebook, I need to complete his information adding Code: fb_uid Code: fb_username 2) If a user arrives to the site for the first time and logins with Facebook, I need to add his Facebook information to the table and take him to a page that allows him to set his password. How could I do that avoiding duplicates? I mean.. preventing a user to have two table rows (one with user_id, first_name, email, etc) and another row just with Facebook information? I know this is really poorly explained so please don't refrain to ask questions. Thanks. Mike Facebook and Standard Codeigniter Login - El Forum - 04-24-2012 [eluser]boltsabre[/eluser] http://developers.facebook.com/docs/user_registration/flows/ Facebook and Standard Codeigniter Login - El Forum - 04-24-2012 [eluser]Keylocker[/eluser] Awesome. I'll have a look! Facebook and Standard Codeigniter Login - El Forum - 04-24-2012 [eluser]boltsabre[/eluser] no worries! If you're interested there is also a CI library/module called a3m (marshmallow for CI2) which helps to integrate FB, Twitter, Google, Yahoo and OpenID login/registration. It takes a bit of hacking and research to suit your needs, but I got mine up and going in about 3 weeks (that's pt though, so perhaps 4 - 5 full 8hr days it took me). Facebook and Standard Codeigniter Login - El Forum - 04-24-2012 [eluser]Demilium[/eluser] What I did, was request the users email as a permission when they're logging in with the Facebook SDK. Then I checked to see if the user had already registered by checking the Facebook e-mail against the rows in the database -- and if so update the row with the fb_uid, etc. Also, I stored the access_token (but an extended one, since the 'offline_access' permission has been depreciated). Hope this helps. Facebook and Standard Codeigniter Login - El Forum - 04-25-2012 [eluser]Keylocker[/eluser] Yes that might work but only if your email is the same that you used to register to Facebook Facebook and Standard Codeigniter Login - El Forum - 04-25-2012 [eluser]Demilium[/eluser] It's the only feasible way I can see to be honest. |