0

我尝试按照 symfony 主页上的教程运行sfFacebookConnectPlugin 。

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

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

第一步可能是在 Facebook 端找到正确的应用程序设置(例如Post-Authorize Callback URLConnect-URLCanvas Callback URL

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

谢谢你的帮助。

4

3 回答 3

1

我找到了那个页面:http ://burgiblog.com/2009/09/18/developing-facebook-applications-with-symfony/现在它可以工作了,阅读教程后我改变了三件事:

  • modules/sfFacebookConnectAuth/config/security.yml:使用“false”而不是“off”
  • 我在apps/frontend/config/app.yml中添加了“callback_url”
  • 我在教程中使用了 facebook 操作

我需要找出问题到底是什么。我需要对插件进行一些改进。例如,将用户数据保存到我的个人资料类等。(现在我保存了一个神秘的用户名,而不是正确的 FB 用户名。)

于 2010-07-04T22:51:20.153 回答
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; ?>
于 2010-10-01T08:12:40.993 回答
0

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

于 2010-06-26T22:28:21.433 回答