简体   繁体   中英

Uncaught error…FB.Auth.setAuthResponse only compatible with OAuth2

In using the new Javascrip SDK for facebook I get the following error when trying to

(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

What would be the cause of this? my app is in SSL mode and I can't seem to figure out why that error shows up.

Is that definitely the only place the JS SDK is included? Check for copy/pasted Like button init code, etc.

I've seen this error occur when people are including the JS SDK with some parameters in the URL (ie including //connect.facebook.net/en_US/all.js#appid=x somewhere) - this overrides some of the parameters in the FB.init call and can result in the error message you're getting

in my case i had to set oauth2 to true. the error was coming from another facebook plugin that was using oauth2 (which we all should be and all fb docs should reflect that, geez) and conflicting with the oauth1 fb session.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM