facebook登录&重定向

时间:2011-01-20 17:35:31

标签: php javascript facebook

使用Facebook fb:login

登录成功后如何将用户重定向到URL

1 个答案:

答案 0 :(得分:4)

您可以按照FB页面上的基本示例(https://developers.facebook.com/docs/reference/javascript/FB.login/),它将是这样的:

FB.login(function(response) {
   if (response.authResponse) {
     console.log('Welcome!  Fetching your information.... ');
     FB.api('/me', function(response) {
       console.log('Good to see you, ' + response.name + '.');

       window.location = "http://your-site.com/howdy/";

       FB.logout(function(response) {
         console.log('Logged out.');
       });
     });
   } else {
     console.log('User cancelled login or did not fully authorize.');
   }
 }, {scope: 'email'});