javascript - Facebook Connect help -


According to the Facebook API documentation, most of the work is done via Javascript

This means that All processing is done, and then front end checks that the user is connected to facebook / authorized. right?

My question is:

Suppose a user first visits my site. He clicks on "Facebook Connect" Javascript verifies it as authentic, and it "redirects" to the second page on my server, since then, how will I know that the user is actually authenticated on my website because Everything is done on the forehead?

I think this is correct, but there are not some security problems ..:

- Login after user, a page on Facebook Redirects my site to And they also make a cookie with a specific "Facebook ID" that is only obtained from this user. Please "read" my supported cookies and grab that ID ... and then add it to my user id.

If this is correct ... then it does not understand. What if people steal other people's "Facebook IDs" and then make cookies? And then looks at my backend cookie and thinks this is the real user ...?

Am I confused? If I am confused, then help me rearrange and tell me how it is.

Facebook Connect uses a clever (or crazy, depending on your hypocrisy) Hack into the browser to get cross-site communication between your site and the authentication system of Facebook.

The way this works, it is as follows:

  1. Your site contains a very simple static HTML file, which is a cross-domain communication channel This file is known as the xd_receiver.htm in the FB docs, but it can be given a name for you.
  2. Your site's login page contains a reference to the JavaScript library hosted on Facebook's server.
  3. When a user logs via the "Connect" button, then he calls a function in Facebook's JS API, which pops up a login dialog. This login box has an invisible iframe , in which the cross-domain communication file is full.
  4. The user fills the form and submits it, posts the form to Facebook.
  5. Checks Facebook Login If it is successful, then it communicates on your site. Here's where cross-domain comes:
    1. Due to cross-domain security policies, Facebook's login window can not inspect the DOM tree for documents hosted on your server. But within the login code src can update the contents of any iframe , and with the hosted cross-domain communication file Used to communicate on your page.
    2. When a cross-domain communication file receives a hint that the entry is successful, it uses JavaScript to set some cookies with the user's ID and session. Since this file resides on your server, those cookies have your domain and your backend can get them.
  6. Any other communication towards Facebook can be completed by inserting another nested code

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -