authentication - Facebook Connect for the website - database connection and logic -


i trying let users login website using facebook account. have tried reading information related process facebook developers (http://developers.facebook.com/docs/) page - while process , logic sort of make sense, still lost regarding big picture.

how 'facebook connect' link existing database of users , attributes. there user called john walker, registered user (login: jwalker pass:1234 account balance:$10). when come website, , try login using facebook login, how know direct him? in other words, how facebook know right john walker, , should sent user page?

i sorry if question trivial, can't think though myself. in advance!

zachary

well zachary, have little bit misconception regarding facebook connect. when user clicks on facebook connect button placed on site, facebook doesn't go database authenticate user. authenticates user in database whether current user having facebook account or not... if he/she having account facebook issues access token particular user loging him facebook. responsibility login user in system , putting information database. let me explain more , see following code

 <div id="fb-root"></div>  <script>    window.fbasyncinit = function() {    fb.init({appid: "your app id",             status: true,             cookie: true,             xfbml: true});      fb.getloginstatus(function(response) {       if (response.session) {         // place control when user login facebook                 // @ point can redirect user page can put facebook returned information database , login him system        } else {          }     });      fb.event.subscribe("auth.login", function(response) {      window.location.reload();       }); fb.event.subscribe("auth.logout", function(response) {       self.location.href="http://www.iranibash.com/logout.php";       });      };    (function() {     var e = document.createelement("script");     e.src = document.location.protocol + "//connect.facebook.net/en_us/all.js";     e.async = true;     document.getelementbyid("fb-root").appendchild(e);   }());    </script> 

now can use information user facebook returns after successfull login. can have information in $cookie. think can understand information?


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -