简体   繁体   中英

Facebook Login on your site - Help

I have a fully functioning website with user accounts/profiles and admin area. I would like to integrate the Facebook login to my website. I have added the Facebook php sdk to my server. I now have (well, sort of) the Facebook login working on my website.

My problem is that I am unsure if I should register the user automatically, if so how? How do i get them to have a password? + a username? Is this data transfered from Facebook? If so how?

This is my first every attempt at Facebook integration, so please me specific with me.

Any help is appreciated!

By the way, I am using th JavaScript method for logging in, which is:

<fb:login-button></fb:login-button>

The facebook php sdk is just awful. Their javascript api is slightly less awful. I'd recommend using the javascript version and making ajax calls.

What you would want to do is register them automatically with a temporary password. If they authorize your 'app' (site) to email them you can email that password to their facebook proxy email address which (sometimes) is correctly routed to their real email address. From there, it's up to the user if he/she wants to customize their account on your site.

The only thing you really want to store from facebook is the facebook uid per user. Facebook also has very strict privacy policy legalese in place dictating what app builders can and can not store in their local databases. Make sure you read all the fine print.

Prepare for a long road, lots of headaches, and lots of endless nights wondering why your [enter plainly simple situation] has a [enter ridiculously unexplainable bug] and nobody on facebook dev team cares to acknowledge it in the docs, the wiki, or on the forums.

Peace! --Sean

Is this data transfered from Facebook? If so how?

Typical scenario:

  • The user clicks on your button (fb:login)
  • The FB Login Window opens
  • If the user logs into FB then:

A cookie is set from FB (read the cookie value to make sure it's there)

A javascript handler can be called using the FB javascript API

You can use cookie stored information to fetch user data (eg FB profile name) and manipulate it the way you want (eg store it, display it).

I recommend you to have a look at the developer pages at facebook.com for more information.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM