Facebook登录/注册帮助 [英] Facebook Login/Signup Help

查看:437
本文介绍了Facebook登录/注册帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用FB登录/注册按钮的网站。此按钮由JavaScript SDK处理。另外在注册页面中,我还有其他类型的注册表单。所以基本上,我有两种方法来注册我的网站。



这是我的Facebook注册代码:

  FB.init {
appId:'xxxxxxxxx',
cookie:true,
status:true,
xfbml:true
});

FB.Event.subscribe('auth.login',function(){processLogin()});

function processLogin(){
if(FB.getSession()!= null){
FB.api('/ me',function(user){
if(user!= null){
#Ajax代码,用于将数据插入数据库#
}
});
}
}

现在我的问题是,每当我当前登录进入我的Facebook帐号,并选择使用传统的注册表单,名为processLogin的javascript函数将被触发,而无需单击FB注册按钮。我还是FB SDK的新手,但我相信FB.Event.subscribe('auth.login',function(){processLogin()}); 正在导致问题。我该如何解决这个问题?任何建议将不胜感激。



谢谢!

解决方案

相信你想要 auth.change over auth.login 。让我知道,如果这不能解决你的问题。


I have a site that uses FB Login/Signup button. This button is handled by JavaScript SDK. Also in the sign up page, I have another type of signup form. So basically, I have two ways on how to sign up on my site.

Here is my Facebook Signup Code:

FB.init({ 
  appId:'xxxxxxxxx', 
  cookie:true, 
  status:true, 
  xfbml:true 
});

FB.Event.subscribe('auth.login', function() { processLogin() } );

function processLogin(){
  if(FB.getSession() != null){ 
    FB.api('/me', function(user) {
      if(user != null) {
        #Ajax code here for inserting data to the database#
      }
    });
  }
}

Now my problem is, whenever I'm currently logged in to my facebook account, and opt to do the conventional sign up form, the javascript function called 'processLogin' will be triggered without clicking the FB sign up button. I am still new to FB SDK, but I believe the FB.Event.subscribe('auth.login', function() {processLogin()}); is causing the problem. How will I fix this problem? Any suggestion would be greatly appreciated.

Thanks!

解决方案

I believe you want auth.change over auth.login. Let me know if that doesn't solve your issue.

这篇关于Facebook登录/注册帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆