开发者

facebook login button integration - user not getting forwarded

I have put on my site 开发者_如何转开发facebook login button. Now after they login and grant permissions, I like to forward them to the post-login page.

The problem is that after they login, it doesn't get forwarded to the post-login page.

  FB.login(function(response) {
  if (response.session) {
  if (response.perms) {
    window.location = "http://www.mysite.com/postlogin.aspx";
    // user is logged in and granted some permissions.
    // perms is a comma separated list of granted permissions
  } else {
    // user is logged in, but did not grant any permissions
    }
  } else {
  // user is not logged in
    }
    }, {perms:'read_stream,publish_stream,offline_access'});

Thanks Behrouz


Are you sure you're getting into that inner if statement (if (response.perms))?


I believe the if(response.perms) is unnecessary. Try removing it. Another method would be to add this line: FB.Event.subscribe('auth.login', function() { window.location = "http://www.mysite.com/postlogin.aspx"; });

This subscribes your page to the auth.login event, and should forward the user after login is completed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜