Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/280.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 应用程序2017年7月更新后,通过Facebook登录停止工作_Javascript_Php_Facebook_Codeigniter_Facebook Graph Api - Fatal编程技术网

Javascript 应用程序2017年7月更新后,通过Facebook登录停止工作

Javascript 应用程序2017年7月更新后,通过Facebook登录停止工作,javascript,php,facebook,codeigniter,facebook-graph-api,Javascript,Php,Facebook,Codeigniter,Facebook Graph Api,以前通过facebook登录工作正常,没有任何问题。使用Javascript SDK通过facebook登录在PHP codeigniter网站上实现。但2017年7月更新后,我无法通过facebook登录网站 下面是我的代码。请协助 <script type="text/javascript" defer="defer"> window.fbAsyncInit = function () { FB.init({

以前通过facebook登录工作正常,没有任何问题。使用Javascript SDK通过facebook登录在PHP codeigniter网站上实现。但2017年7月更新后,我无法通过facebook登录网站

下面是我的代码。请协助

<script type="text/javascript" defer="defer">
            window.fbAsyncInit = function () {
             FB.init({
             appId: "<?php echo $global['facebook_app_id']; ?>", // App ID
             channelUrl: "<?php echo base_url(); ?>channel.html", // Channel File 
             status: true, // check login status
             cookie: true, // enable cookies to allow the server to access the session
             picture: "http://www.fbrell.com/f8.jpg",
             xfbml: true  // parse XFBML
             });
             };
             // Load the SDK Asynchronously
             (function (d) {
             var js, id = "facebook-jssdk", ref = d.getElementsByTagName("script")[0];
             if (d.getElementById(id)) {
             return;
             }
             js = d.createElement("script");
             js.id = id;
             js.async = true;
             js.src = "//connect.facebook.net/en_US/all.js";
             ref.parentNode.insertBefore(js, ref);
             }(document));
        </script>



                function loginMe(path)
            {
                var params1 = '';
                FB.login(function (response) {
                    if (response.authResponse) {
                        console.log('Welcome!  Fetching your information.... ');
                        FB.api('/me', function (response) {
                            var params = "username=" + response.username + "&first_name=" + response.first_name + "&last_name=" + response.last_name + "&email=" + response.email + "&fb_id=" + response.id + "&gender=" + response.gender + "&birthday=" + response.birthday + "&action_type=fb_login";
                            //var params="email="+response.email; 
                            FB.api('/me/friends', function (response) {
                                //                                 alert(JSON.stringify(response));
                                var i = 0;
                                $.each(response.data, function (key, val) {
                                    i++;
                                });
                                params1 = "&facebook_friend_count=" + i;
                            });
                            if (typeof (response.email) === "undefined") {
                                alert('Sorry, there is technical problem to fetch data from facebook, please try again.');
                                window.parent.location = path;
                            }
                            jQuery.ajax({
                                type: 'post',
                                url: path + 'login-with-facebook',
                                data: params,
                                success: function (msg) {
                                    if (msg != '' && msg != 'fail') {
                                        window.location.href = path + "login-with-fb/" + msg;
                                    }
                                    else
                                    {
                                        if (msg == 'fail')
                                            alert('Sorry, there is technical problem to fetch data from facebook, please try again.');
                                        window.parent.location = path;
                                    }
                                }
                            });
                        });

                    } else {
                        //console.log('User cancelled login or did not fully authorize.');
                    }
                }, {"scope": "email,read_stream"});
            }               

window.fbAsyninit=函数(){
FB.init({
appId:,//应用程序ID
channelUrl:“channel.html”,//频道文件
状态:true,//检查登录状态
cookie:true,//启用cookie以允许服务器访问会话
图片:“http://www.fbrell.com/f8.jpg",
xfbml:true//解析xfbml
});
};
//异步加载SDK
(职能(d){
var js,id=“facebook jssdk”,ref=d.getElementsByTagName(“脚本”)[0];
if(d.getElementById(id)){
回来
}
js=d.createElement(“脚本”);
js.id=id;
js.async=true;
js.src=“//connect.facebook.net/en_US/all.js”;
ref.parentNode.insertBefore(js,ref);
}(文件);
函数登录(路径)
{
var params1='';
FB.登录(功能(响应){
if(response.authResponse){
log('欢迎!获取您的信息…);
FB.api('/me',函数(响应){
var params=“username=“+response.username+”&first_name=“+response.first_name+”&last_name=“+response.last_name+”&email=“+response.email+”&fb_id=“+response.id+”&gender=“+response.gender+”&birth=“+response.birth+”&action_type=fb_login”;
//var params=“email=”+response.email;
FB.api('/me/friends',函数(响应){
//警报(JSON.stringify(响应));
var i=0;
$.each(response.data,function(key,val){
i++;
});
params1=“&facebook\u friend\u count=“+i;
});
if(typeof(response.email)=“未定义”){
警报('抱歉,从facebook获取数据时出现技术问题,请重试');
window.parent.location=路径;
}
jQuery.ajax({
键入:“post”,
url:path+“使用facebook登录”,
数据:params,
成功:功能(msg){
如果(msg!=''&&msg!='fail'){
window.location.href=path+“使用fb登录/”+msg;
}
其他的
{
如果(消息=='fail')
警报('抱歉,从facebook获取数据时出现技术问题,请重试');
window.parent.location=路径;
}
}
});
});
}否则{
//log('用户取消登录或未完全授权');
}
},{“范围”:“电子邮件,阅读流”});
}               
每次输入登录凭据后,我都会收到警告:“对不起,从facebook获取数据存在技术问题,请重试。”我无法从facebook获取用户详细信息。

user\u posts
可能会解决您的问题

。更新配置代码以使用更高版本,并确保一切正常。您可能还应该查看中的更改

以下是来自以下站点的配置示例:

window.fbAsyninit=function(){
FB.init({
appId:'您的应用程序id',
自动假肢:对,
xfbml:是的,

版本:“v2.10”//没有名为
read\u stream
的权限,read\u stream现在的替代方案是什么?Facebook经常不推荐其API版本。例如,。请确保保持最新(这可能意味着更新库)。我们使用的是v2.3,在7月8日问题开始后是。我们已经使用Javascript SDK通过facebook实现了登录。更新库的位置?很可能是试图用用户帖子替换read_stream的副本仍然无效。仍然无法获取用户详细信息。您使用的是哪一版本的API?API版本2.3此处有指向upgra的链接取消指南。如果您需要更多帮助,请将您的skype u/n发送给我,我会尝试让您继续。我尝试按照升级指南进行更改,但仍然没有成功。尝试按照升级指南进行更改。仍然存在相同的问题。您是否更改了我在回答中显示的
版本
值?请编辑您的问题并在那里添加代码。您可以n选择它并按Ctrl+K或单击
{}
按钮以正确设置格式。我添加了当前的Facebook java script sdk代码。版本字段不在那里。当我尝试添加版本字段时,Facebook登录的弹出窗口被禁用。@CBroe,很好的回答。我在对问题的评论中正确,然后在回答中错误。我已经解决了这个问题。