I am trying to implement Facebook Login functionality to my website. I followed the instructions, and have entered the code correctly as far as I can see it. Here is my code:
<div id="fb-root"></div>
<div class="fb-login-button" data-scope="email" >Login with Facebook</div>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'MY_APP_ID',
status : true,
cookie : true,
xfbml : true,
oauth : true,
});
};
(function(d){
var js, id = 'facebook-jssdk'; if (d.getElementById(id)) {return;}
js = d.createElement('script'); js.id = id; js.async = true;
js.src = "//connect.facebook.net/en_US/all.js";
d.getElementsByTagName('head')[0].appendChild(js);
}(document));
If you see something I don’t, please let me know. This should work as far as I can tell (after following facebook’s instructions).
Thanks for the help in advance.
I’m assuming you’re replacing MY_APP_ID with your actual ID, and closing your script section. If that’s not the problem, I’d need to see more of your HTML source besides the snippet you provided.
Here is an example html page source, that has a button to login/logout, depending on whether you’re currently logged in or not. It also displays the logged in users profile pic when logged in. It’s an example I made based on the facebook docs, but I’ve tested it and it works. Obviously you’ll need to replace the app id with an actual app id.