FB.login不会从内页返回authResponse

时间:2017-01-05 14:23:55

标签: login facebook-javascript-sdk

在FB.login上我得到了

  

未捕获的SyntaxError:位于

的JSON中的意外的令牌\

  

{\ “算法\”:\ “HMAC-SHA256 \”,\ “代码\”:\” ...

但我正在等待此代码中的 authResponse 状态

$(function () {
  window.fbAsyncInit = function () {
    FB.init({
        appId: server_data.keys.fb_app_id,
        cookie: true,
        xfbml: true,
        version: 'v2.6'
    });
  };

  (function (d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s);
    js.id = id;
    js.src = "//connect.facebook.net/en_US/sdk.js";
    fjs.parentNode.insertBefore(js, fjs);
  }(document, 'script', 'facebook-jssdk'));

  $(document).on('click', '[login]', function() {
    $('[login] .auth__auth-btn_text').text('Loading ...');
    FB.login(function (response) {
        statusChangeCallback(response);
    }, {scope: 'public_profile,user_friends,email'});
  });

  function statusChangeCallback(response) {
    console.log(response);
  }

});
'use strict';

更新

功能响应正常 - 来自http://localhost:5000/ authResponse

但是我仍然在内页上调用未捕获的SyntaxError:意外的令牌,例如 http://localhost:5000/note?id=1

即使更改了developers.facebook.com/apps设置:

enter image description here

0 个答案:

没有答案