2010-06-26 54 views
0

我试图通过关注symfony主页上的tutorial来运行sfFacebookConnectPluginsfFacebookConnectPlugin:身份验证问题

一切看起来都很好配置。但是当我尝试使用sfFacebookConnectAuth/signin登录时。 我收到表单错误“用户名和/或密码无效。”“。

我甚至不知道从哪里开始调试。

第一步可以是找出Facebook上的边右应用程序设置(如后授权回调URL连接的URL帆布回调URL

我用的symfony 1.4.5 sfGuardDoctrinePlugin原则(在带有子域的实时主机上)。

Thx for your help。

回答

0

它在插件页面上说这个插件只支持/稳定到Symfony 1.2。对于1.4兼容性直接向插件作者发送电子邮件可能有意义。

+0

是的,我认出来了,这是非常令人困惑,但我说的是教程是Symfony的1.4,所以应该是兼容的。 – ownking 2010-06-27 02:10:11

+0

想知道是否有这么少的开发人员使用此插件(或有问题): -/ – ownking 2010-06-29 18:17:14

+0

可能是因为它在主页上说1.2。任何Symfony的新手都将从1.4开始,许多人已经在等待2.0。 – Tom 2010-06-29 20:47:44

1

我发现页面:http://burgiblog.com/2009/09/18/developing-facebook-applications-with-symfony/现在的作品,我看完教程后改为三件事情:

  • 模块/ sfFacebookConnectAuth /配置/ security.yml:使用“假”,而不是“关”
  • 我在应用程序/前端/配置/ app.yml
  • 加入“callback_url”我使用Facebook的行动教程

我需要找出,什么问题是究竟。我需要增强一些插件的东西。例如。将用户数据保存到我的配置文件类等(现在我保存了一个神秘的用户名,而不是正确的FB用户名。)

0

我遇到了sfFacebookConnectPlugin的一些问题。我试图从http://burgiblog.com/2009/09/18/developing-facebook-applications-with-symfony/复制简单的例子。并调用索引页,我重定向到Facebook身份验证页面,但登录后,我不会重定向回来。我只保留登录Facebook。我究竟做错了什么?

谢谢。

这是我的代码:

[/frontend/config/app.yml] 

# default values 
all: 
    facebook: 
    api_key: xxx 
    api_secret: xxx 
    api_id: xxx 
    callback_url: 'http://localhost' 
    redirect_after_connect: false 
    redirect_after_connect_url: '' 
    connect_signin_url: 'sfFacebookConnectAuth/signin' 
    app_url: '/my-app' 
    guard_adapter: ~ 
    js_framework: none # none, jQuery or prototype. 

    # It is highly recommended to use a js framework if you want a correct experience in IE 

    sf_guard_plugin: 
    profile_class: sfGuardUserProfile 
    profile_field_name: user_id 
    profile_facebook_uid_name: facebook_uid # WARNING this column must be of type bigint ! 100000398093902 is a valid uid for example ! 
    profile_email_name: email 
    profile_email_hash_name: email_hash 

    facebook_connect: 
    load_routing:  true 
    user_permissions: [] 


[layout.php] 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" xmlns:fb="http://www.facebook.com/2008/fbml"> 
<head> 
<?php use_helper('sfFacebookConnect') ?> 
<?php include_http_metas() ?> 
<?php include_metas() ?> 
<?php include_title() ?> 
<link rel="shortcut icon" href="/favicon.ico" /> 
</head> 
<body> 

<?php echo $sf_content ?> 

<?php include_bottom_facebook_connect_script(); ?> 

</body> 
</html> 



[actions.class.php] 

<?php 

/** 
* facebook actions. 
* 
* @package 
* @subpackage facebook 
* @author  Your name here 
* @version SVN: $Id: actions.class.php 12479 2008-10-31 10:54:40Z fabien $ 
*/ 
class homeActions extends sfActions 
{ 
    /** 
    * Executes index action 
    * 
    * @param sfRequest $request A request object 
    */ 

    public function executeIndex(sfWebRequest $request) 
    { 
     sfFacebook::requireLogin(); 
     //get the user object 
     $user = $this->getUser(); 

     // facebook user id 
     $this->fb_uid = $user->getCurrentFacebookUid(); 
     // get or create user based on fb_uid 
     $fb_user = sfFacebook::getOrCreateUserByFacebookUid($this->fb_uid); 
    } 
} 



[indexSuccess.php] 

<?php if ($sf_user->isFacebookConnected()): ?> 

<fb:serverfbml style="width: 740px;"> 
    <script type="text/fbml"> 
     <fb:fbml> 
      <fb:request-form target="_top" action="[where to redirect after invite]" method="post" type="[name of your app]" content="[text the user will receive]&lt;fb:req-choice url=&quot;http://apps.facebook.com/[your app]/&quot; label=&quot;Accept!&quot; " image="" invite="true"> 
       <fb:multi-friend-selector cols="4" actiontext="[some text above the invite form]" /> 
      </fb:request-form> 
     </fb:fbml> 
    </script> 
</fb:serverfbml> 

<?php else: ?> 
<p>Ooops?</p> 
<br /> 
<?php endif; ?> 
+1

您的回叫网址必须可以从外部访问。本地主机根本无法工作。将您的代码上传到服务器,然后更改回调网址。 – ownking 2010-10-01 12:52:42