Facebook connect integration (registration & login)
I'm really struggling to make facebook connection working for my system. What I want to do:
- When the user is not yet registered on facebook:
- Fetch some user profile fields into my开发者_运维技巧 database (ideqally via my registration page already working for non facebook users)
- Log the user into my website
- Redirect the user into my homepage
- What I've done so far :
- Set up the application in FB
- Add the Facebook class from the github website and integrate some code to make it working
- Add additionnal paremeters to login/register facebook link.
I'm struggling to redirect the user after authorizing, to my register page (register/?facebook). The "Post-Authorize Redirect URL" field doesn't seem to work properly, I maybe do not fill the right field?
My other question is, if my registration page uses a redirection show (index.php redirect to register.php), do the information given by facebook through the $_POST method would be available in the register.php page?
I finally managed to get all of this working, so if you're still struggling here is what I've done :
- Concerning my redirect problem: the facebook php-sdk class redirection page ("next" attribute) is DIRECTLY written, so I just change the 'next' value given in the getLoginUrl() and getLogoutUrl() function.
- Concerning the lost of the facebook login between the pages: the problem was that the domain of the cookie created wasn't specified, so I added " 'domain' => 'mydomain.com', " for the declaration of my new Facebook instance.
Don't send data to register.php
via _POST. Use the facebook php SDK's methods to retrieve the data from current logged in user's session.
精彩评论