I am trying to implement facebook Connect to my cakephp Application. i am using Nick’s Facebook Plugin.
I wanna implement it this way
- When a user Visits the Site he should be able to login via Registration on the site or Facebook Connect
- Existing users should be able to connect their account to their FB account
- People who first time login to the site using FB Connect and dont have an account on the site. should be redirected to a page where they have to enter details to complete the profile.
What i have done –
I have followed the instruction of Nick to implement it and when i click Login – it connects to my app. but i dont understand how to create a username and password associated with the Fb Connect Id. and user it against the FB token.
Apparently I’m doing the same thing a little before you… 😉
Here’s a method for Facebook login I’m using (slightly redacted and annotated):
This gives me an array with all the user details I could grab from Facebook and invokes
::oauthLogin, which either logs the user in with the given information or asks the user to fill in missing details and/or creates a new user record in the database. The most important part you get from the Facebook API is the$userInfo['id']and/or email address, either of which you can use to identify the user in your database. If you’re using the AuthComponent, you can “manually” log in the user using$this->Auth->login($user_id), where$user_idis the id of the user in your own database.