I have a website that have facebook connection and classic user_name/password login. The system currently works if user clicks facebook_connect button. However, I want to link existing account to facebook because user can choose to login with his/her user_name, password credentials and also want to make facebook auto-connected after clicking facebook connect button. I have a field namely fb_connect
(1 or 0) that holds if user uses facebook connect or not. So, the scenario is the following ;
1) I chosed to register with facebook connect. I clicked facebook connect button and got $user
field. My website make a registration process, gets facebook email, generates a password and sends login credentials to the email address to make user also login with email/password.
2) When I got the email, I say : "Well, it looks ok, let me try with these login credentials( email/password) and check if the website already linked the account with these credentials"
3) I enter the website and used normal login. (PROBLEM 1 OCCURS HERE) My website checks if fb_connect
is 1 or 0. if it's 1 then, my website calls FB.login
function in the javascript sdk of facebook.
PROBLEM 1 : If users have existing account and use classic login, I don't want users to see an empty dialog flashes for 1-2 seconds after each login to the system.
PROBLEM 2 : When I open private browsing in chrome or mozilla and use classic login like in the problem 1's case, facebook popup wants facebook user_name and password to login. But, I certainly don't want that.
I looked at twitter and opened a private tab. After logging in to twitter and check if facebook is linked or not, twitter says my existing account is linked. I say "How's that happened ? Twitter doesn't make me enter login credentials for facebook ??? "
I think I'm doing something wrong. I really need help. I'm using php. Some logical statements, algorithms and code is needed. Any help will be greatly appreciated.