facebook - Uncaught Error ...FB.Auth.setAuthResponse 仅与 OAuth2 兼容

标签 facebook authentication oauth-2.0

在使用 facebook 的新 JavaScript SDK 时,我在尝试时遇到以下错误

(function() {
var e = document.createElement('script'); e.async = true;
e.src = document.location.protocol +
  '//connect.facebook.net/en_US/all.js';
document.getElementById('fb-root').appendChild(e);}());
window.fbAsyncInit = function(e) {
var curLoc = window.location;
var channel = curLoc.protocol + "//" + curLoc.hostname + (curLoc.pathname).substr(0,(curLoc.pathname).lastIndexOf('/')) + "/channel.html";
FB.init({ appId: APP_ID, 
    status: true, 
    cookie: true,
    xfbml: true,
    channelUrl: channel,
    oauth: true});
FB.getLoginStatus(isUserLoggedIn);
FB.Canvas.setAutoGrow();}

Uncaught Error: FB.Auth.setAuthResponse only compatible with OAuth2

造成这种情况的原因是什么?我的应用程序处于 SSL 模式,我似乎无法弄清楚为什么会出现该错误。

最佳答案

这肯定是唯一包含 JS SDK 的地方吗?检查复制/粘贴的 Like 按钮初始化代码等。

我发现当人们在 URL 中包含带有某些参数的 JS SDK 时会发生此错误(即在某处包含//connect.facebook.net/en_US/all.js#appid=x ) - 这会覆盖一些FB.init 调用中的参数可能会导致您收到错误消息

关于facebook - Uncaught Error ...FB.Auth.setAuthResponse 仅与 OAuth2 兼容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7799253/

相关文章:

python - (如何)我可以使用 requests.OAuth2Session 发送(准备好的)请求?

javascript - RingCentral JavaScript SDK(HTTP 400 - 未授权此授权类型)

python - LinkedIn API get/v2/me 返回 "Unpermitted fields present in PARAMETER"

android - 使用 Facebook Android SDK 在没有打开对话框的情况下发布附件?

authentication - ServiceStack - UserAuth "Id"是 INT,而 RavenDb 预计 "Id"是 STRING

php - 重定向到身份验证对话框 - "An error occurred. Please try again later"

c# - 在没有 Windows 访问权限的情况下使用凭据信息访问共享文件夹

android - 在具有相同凭据的两个 Android 应用程序之间共享登录数据

ios - XCode 4.5,Facebook SDK 3.1 实现导致 "...selected destination does not support the architecture ..."错误

facebook - 如何使用 C# SDK 更新 Facebook 访问 token