2

I am using the following code to enable users to login. It works perfectly but the problem is that it shows the name of website rather than signin - sign out so user is not able to sign out. how should I change it to enable users to sign out ? based on blew comment I added autologoutlink="true" and now singout is visible but when user is signed in it write a sentence as following jack is logged in myproject (jack is username and myproject is name of my project)

<html>
<head></head>
<body>
<div id="fb-root"></div>
<script>
  window.fbAsyncInit = function() {
  FB.init({
    appId      : 'YOUR_APP_ID', // App ID
    channelUrl : '//WWW.YOUR_DOMAIN.COM/channel.html', // Channel File
    status     : true, // check login status
    cookie     : true, // enable cookies to allow the server to access the session
    xfbml      : true  // parse XFBML
  });


  FB.Event.subscribe('auth.authResponseChange', function(response) {
    if (response.status === 'connected') {
      testAPI();
    } else if (response.status === 'not_authorized') {
      FB.login();
    } else {
      FB.login();
    }
  });
  };

  (function(d){
   var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0];
   if (d.getElementById(id)) {return;}
   js = d.createElement('script'); js.id = id; js.async = true;
   js.src = "//connect.facebook.net/en_US/all.js";
   ref.parentNode.insertBefore(js, ref);
  }(document));


  function testAPI() {
    console.log('Welcome!  Fetching your information.... ');
    FB.api('/me', function(response) {
      console.log('Good to see you, ' + response.name + '.');
    });
  }
</script>

<fb:login-button show-faces="true" width="200" max-rows="1"></fb:login-button>
</body>
</html>

1 Answers1

0

autologoutlink="true"

Add this parameter to your fb:login-button:

<fb:login-button show-faces="true" width="200" autologoutlink="true" max-rows="1"></fb:login-button>

Hope it helps!

ThePCWizard
  • 3,338
  • 2
  • 21
  • 32
  • great, but when I logout it shows the small window of Facebook to logout how can I keep it in my website page? –  Jul 09 '13 at 12:17
  • sorry i didn't understand. Can you share a screenshot? – ThePCWizard Jul 09 '13 at 12:37
  • 1
    is your problem solved? if not please explain it more clearly. – ThePCWizard Jul 10 '13 at 10:07
  • Thanks for your comment, it shows the sign in and sing out buttons but when user is signs in it write a sentence as following jack is logged in myproject (jack is username and myproject is name of my project) –  Jul 10 '13 at 23:11
  • I see I will give it a try where do you get this info from ? I could not find them on facebook. –  Jul 11 '13 at 06:58
  • We have to dig deep in the Facebook docs to find all this. Try it and tell if it works or not. – ThePCWizard Jul 11 '13 at 07:23
  • did you replaced this `show-faces="true"` with this `show-faces="false"`? Can you upload a screenshot of your problem? – ThePCWizard Jul 13 '13 at 10:14
  • Great it works now, would you please have a look at this question as well many thanks http://stackoverflow.com/questions/17618398/facebook-does-not-show-thumbnail-when-a-photo-is-shared –  Jul 14 '13 at 10:09
  • yeah, i would help out on that question but before that if this problem is solved then please close this question by accepting the answer... – ThePCWizard Jul 14 '13 at 18:57
  • Oooo I am sorry I forgot. –  Jul 14 '13 at 23:46