开发者

FB.Auth.setAuthResponse only compatible with OAuth2 issue

开发者 https://www.devze.com 2023-04-08 05:11 出处:网络
Loading my facebook page in a tab shows following error: FB.Auth.setAuthResponse only compatible with OAuth2.

Loading my facebook page in a tab shows following error:

 FB.Auth.setAuthResponse only compatible with OAuth2.

I use oauth parameter like this:

FB.i开发者_StackOverflow社区nit({
    appId: fbAppId,
    status: true,
    cookie: true,
    xfbml: false,
    oauth: true
});

Am I doing something wrong ?


remove the parameters from your JDK including:

script src="http://connect.facebook.net/en_US/all.js"


  1. Log in to the Facebook account that is in charge of the App.
  2. Go to https://developers.facebook.com/apps/ and click on the App in question.
  3. In the left menu, under Settings, click Advanced and look at the settings in the Migrations section.

I encountered this issue on a test environment of mine, and switched the "Encrypted Access Token" setting to 'Enabled' and it seems to resolve the issue for me. I did all this code work for the migration but had NO IDEA that I had to go into the App and mess with settings.

HTH


Some Facebook social plugins(the ones that require actually inserting JavaScript) have their own authentication scheme. The newly implemented Add To Timeline button is one example of a social plugin that will cause this error to appear in your JS console. Try removing social plugins and see if the error persists. If they disappear, your only real option is to switch to XFBML.


when using outh 2 add oauth=1 to provided js function for social plugins

<script>(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/tr_TR/all.js#**oauth=1**&xfbml=1&appId=164442023647373";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>


i had this error when using

ow.fbAsyncInit = function() {
    FB.init({
        appId   : '<s:property value="app_id" />',
        status  : true, // check login status
        cookie  : true, // enable cookies to allow the server to access the session
        xfbml   : true,  // parse XFBML
        oauth   : true
    });

Old variables i used:

response.session.access_token
response.session.uid

New variables helped:

response.authResponse.accessToken
response.authResponse.userId
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号