0

我使用 Fb.Login 在我的 facebook 应用程序中登录用户。是否存在 redirect_uri 参数的可能性?成功登录后,我想将用户重定向到:https://www.facebook.com/page/app_33229693355?app_data=code,在经典登录时,我使用 redirect_uri 参数在登录后重定向,但是在这里?

FB.login(function(response) {
}, {scope: \'publish_stream, photo_upload, user_birthday\'});

我需要这个,因为下一步是在 php 中写一张图片。

4

1 回答 1

0
  FB.Event.subscribe('auth.login', function () {
      window.location = "http://example.com";
  });

当身份验证状态更改为已连接时,将触发重定向。查看此FB.Event.subscribe链接以获取更多信息。

如果你想要用户数据,

 FB.login(function(response) {
   if (response.authResponse) {
     console.log('Welcome!  Fetching your information.... ');
     FB.api('/me', function(response) {
         // make an ajax call to your php code and pass the name etc ...
         // on success of the ajax call, use window.location to redirect 
        console.log('Good to see you, ' + response.name + '.');
     });
   } else {
     console.log('User cancelled login or did not fully authorize.');
   }
 });
于 2013-01-09T05:14:42.740 回答