Posted on : 2020-04-27 14:49:27 View Type: public
Jeremy Blur
Do you have a user guide how to adapt the script to intgrate facebook login ?
The user guide is very very light
Do you have a user guide how to adapt the script to intgrate facebook login ?
The user guide is very very light
Please go to
http://facebook.com/developers/ Register new app add your website url to its Web URL make your app live.
And get your API key from dashboard.
Copy that API key and paste that in Settings >> Facebook login also check the box Enable Facebook login so facebook login can be activated.
Hi this seems to be the extra testing code which was left in script, which you can remove or we would remvoe in our update you can leave it for now .
If you check register.php
This is the code below registration form which generates the Facbeook button.
<?php if(get_option('facebook_login') == '1') { ?>
<center><fb:login-button scope="public_profile,email" size="xlarge" onlogin="checkLoginState();">
<?php _e("Register With Facebook"); ?>
</fb:login-button></center>
<?php } ?>
And in same file on top we have this code which includes facebook file and message returned from facebook for errors.
if(get_option('facebook_login') == '1') {
include('lib/includes/add_facebook.php');
echo '<div id="fb_return_msg"></div>';
}
Here is the facebook API login example which expect an API 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 : '{api-version}' // 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(d, s, id) { // Load the SDK asynchronously
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "https://connect.facebook.net/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
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 scope="public_profile,email" onlogin="checkLoginState();">
</fb:login-button>
<div id="status">
</div>
</body>
</html>
Details can be found here. https://developers.facebook.com/docs/facebook-login/web/
If you face problems setting up facebook login system you can send me your logins with your FTP and your website's API key from facebook and i would setup this for you and would solve the issues if there would be any but i guess many people are using it and its working fine for them.