javascript - Login via Facebook stopped working after app July 2017 update -
previously login via facebook working fine without issues.login via facebook using javascript sdk implement on php codeigniter website. after july 2017 update unable login website via facebook.
below 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 allow server access session picture: "http://www.fbrell.com/f8.jpg", xfbml: true // parse xfbml }); }; // load 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 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 = 0; $.each(response.data, function (key, val) { i++; }); params1 = "&facebook_friend_count=" + i; }); if (typeof (response.email) === "undefined") { alert('sorry, there technical problem fetch data 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 technical problem fetch data facebook, please try again.'); window.parent.location = path; } } }); }); } else { //console.log('user cancelled login or did not authorize.'); } }, {"scope": "email,read_stream"}); } every time after entering login credentials getting alert " sorry, there technical problem fetch data facebook, please try again." unable fetch user details facebook.
https://developers.facebook.com/docs/facebook-login/permissions/#reference-read_stream
user_posts may fix problem
https://developers.facebook.com/docs/facebook-login/permissions/#reference-user_posts
Comments
Post a Comment