开发者

Facebook connect integration (registration & login)

I'm really struggling to make facebook connection working for my system. What I want to do:

  1. When the user is not yet registered on facebook:
    1. Fetch some user profile fields into my开发者_运维技巧 database (ideqally via my registration page already working for non facebook users)
    2. Log the user into my website
    3. Redirect the user into my homepage
  2. 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 :

  1. 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.
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜