Need help with Facebook Login. When I try to log in and get an acess_token to work with the Facebook API, I get the error "It looks like this app isn't available".

And I can't find a clear answer why this error occurs.
The permissions I'm requesting from Facebook are: pages_read_engagement, pages_show_list
From different answers (including the one on Stack Overflow), I tried the following solutions:
email and public_profile permissions are set to advanced accessi had the same problem although i did not made any changes in the app settings by myself, my Facebook Login was changed to Facebook Login for Businesses. I then followed the tutorial to create a Config in Sidepanel of the App -> Facebook Login for Businesses -> Configurations. You get a config_id which i appended to my existing query string i use for invoking a manual dialog. The string looks like this on my side:
https://www.facebook.com/v17.0/dialog/oauth?client_id=XXXXXXXXX&redirect_uri=https://XXXXXXX.COM&state=some_string&config_id=XXXXXXXXX
after that i could successfully request an access_token
I think you're using Facebook Login For Business instead of Facebook login.
In this case, you need to create a specific configuration and use it in your FB Login Button.
Full sample code:
<!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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With