“此应用程序似乎无法使用”Facebook 应用程序登录错误

问题描述 投票:0回答:4

需要有关 Facebook 登录的帮助。当我尝试登录并获取

acess_token
以使用 Facebook API 时,收到错误“看起来此应用程序不可用”。

而且我找不到明确的答案为什么会出现这个错误。 我向 Facebook 请求的权限是:

pages_read_engagement
pages_show_list

根据不同的答案(包括 Stack Overflow 上的答案),我尝试了以下解决方案:

  1. “App ID”和“App Secret”完全正确(因为开发者帐户中的一切都正常)。
  2. 应用程序处于“实时”模式
  3. email
    public_profile
    权限设置为高级访问
  4. “应用程序域”和“OAuth 重定向 URI”配置正确。
  5. “隐私政策 URL”和“服务条款 URL”
facebook facebook-login
4个回答
1
投票

就我而言,我收到此错误是因为我在

Facebook Login for Business
上使用
configId
而不是 config_id

FB.login(
  function(response) {
    console.log(response);
  },
  {
    config_id: '<CONFIG_ID>' // right
    // configId: '<CONFIG_ID>' // wrong
  }
);

1
投票

我也遇到同样的问题

我尝试了所有方法,但问题是当我之前“未验证业务”创建应用程序时,Meta 通知我验证您的业务。在我验证业务后,它最终仍然无法工作,我存档并创建一个新应用程序,它开始工作。

注:

如果旧应用程序中有重要数据,请勿存档。因为我在该应用程序中没有任何数据,所以我存档


0
投票

我认为您正在使用

Facebook Login For Business
而不是
Facebook login

在这种情况下,您需要创建一个特定的配置并在您的

FB Login Button
中使用它。

完整示例代码:

<!DOCTYPE html>
<html>
<head>
<title>Facebook Login JavaScript Example</title>
<meta charset="UTF-8">
</head>
<body>
<script>

  function statusChangeCallback(response) {  // Called with the results from FB.getLoginStatus().
    console.log('statusChangeCallback');
    console.log(response);                   // The current login status of the person.
    if (response.status === 'connected') {   // Logged into your webpage and Facebook.
      testAPI();  
    } else {                                 // Not logged into your webpage or we are unable to tell.
      document.getElementById('status').innerHTML = 'Please log ' +
        'into this webpage.';
    }
  }


  function checkLoginState() {               // Called when a person is finished with the Login Button.
    FB.getLoginStatus(function(response) {   // See the onlogin handler
      statusChangeCallback(response);
    });
  }


  window.fbAsyncInit = function() {
    FB.init({
      appId      : '{app-id}',
      cookie     : true,                     // Enable cookies to allow the server to access the session.
      xfbml      : true,                     // Parse social plugins on this webpage.
      version    : 'v17.0'           // Use this Graph API version for this call.
    });


    FB.getLoginStatus(function(response) {   // Called after the JS SDK has been initialized.
      statusChangeCallback(response);        // Returns the login status.
    });
  };
 
  function testAPI() {                      // Testing Graph API after login.  See statusChangeCallback() for when this call is made.
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Successful login for: ' + response.name);
      document.getElementById('status').innerHTML =
        'Thanks for logging in, ' + response.name + '!';
    });
  }

</script>


<!-- The JS SDK Login Button -->

<fb:login-button 
  config_id="{configurationId}"
  onlogin="checkLoginState();">
</fb:login-button>

<div id="status">
</div>

<!-- Load the JS SDK asynchronously -->
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
</body>
</html>

0
投票

我也遇到了同样的问题,尽管我自己没有对应用程序设置进行任何更改,但我的 Facebook 登录已更改为 Facebook 企业登录。然后,我按照教程在应用程序的侧面板 -> Facebook Login for Businesses -> 配置中创建配置。您会得到一个 config_id,我将其附加到我用于调用手动对话框的现有查询字符串中。我这边的绳子看起来像这样:

https://www.facebook.com/v17.0/dialog/oauth?client_id=XXXXXXXXX&redirect_uri=https://XXXXXXX.COM&state=some_string&config_id=XXXXXXXXX

之后我可以成功请求access_token

© www.soinside.com 2019 - 2024. All rights reserved.