Facebook JS API - 登录后如何重定向用户 [英] Facebook JS API - How to redirect user after login

查看:104
本文介绍了Facebook JS API - 登录后如何重定向用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

FB.getLoginStatus(function (response) {
            if (response.session) {
            } else {
                FB.ui({
                    method: 'oauth',
                    perms: 'email,publish_stream',
                    },
                    function (response) {
                        if (response && response.installed) {
                           window.location.reload();
                        }
                    });
            }
        });

我想要的是基本上将用户重定向到同一个页面,以便服务器端可以使用REST API。有没有办法使这项工作?

What I want is to basically redirect the user to the same page so that the serverside can use the REST API. Is there anyway to make this work?

推荐答案

订阅登录活动:

FB.Event.subscribe('auth.login', function (response) {
  window.location.reload();
});

这篇关于Facebook JS API - 登录后如何重定向用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆