dongwei1263 2017-07-25 22:13
浏览 54

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

Previously login via facebook was working fine without any issues.Login via Facebook using Javascript SDK is implement on the PHP codeigniter website. But after July 2017 update I am unable to login to website via facebook.

Below is my code.Kindly assist.

<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"});
            }               

Every time after entering my login credentials I am getting alert " Sorry, there is technical problem to fetch data from facebook, please try again." I am unable to fetch user details from Facebook.

  • 写回答

2条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥15 使用C#,asp.net读取Excel文件并保存到Oracle数据库
  • ¥15 C# datagridview 单元格显示进度及值
  • ¥15 thinkphp6配合social login单点登录问题
  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配