开发者

Facebook login ONLY button (disallows login for new users)

Is it physically possible to design a facebook button that will only allow users who have already joined my website using facebook to log in?

I would like to design this button separately from a button that would allow new users to sign in using their facebook account.

Tha开发者_C百科nks in advance!


No dear there is no special button for doing so but you can write your own logic to accomplish this task. For example After user is logged in with your site, your will capture the login event and redirect the user to any other script where you can check the user id in your application using FQL, If user exists you can return true else return false. And if you recieve return false you can logged of the user.

Some thing like this

FB.Event.subscribe("auth.login", function(response) {
//you Can Send user to any other URL and through $.ajax(); and on success function if you recieve false you can call logout function of facebook like 
   if(data==false) // from $.ajax callback function
  {
  FB.Event.subscribe("auth.logout", function(response) {
// to logout

self.location.href="http://www.yoursite.com/logout.php";
  });
 };
 }
  });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜