HWIOAuthBundle从/ login route:
触发此错误在HWIOAuthBundle:Connect:login.html.twig第8行呈现模板(“没有资源所有者,名称为'google'。”)期间抛出了异常。
甚至不清楚为什么它抱怨'google'而我们没有在任何地方推荐它,但是此刻挂钩了一个facbook连接。有人见过吗?
[1] Twig_Error_Runtime: An exception has been thrown during the rendering of a template ("No resource owner with name 'google'.") in "HWIOAuthBundle:Connect:login.html.twig" at line 8.
at n/a
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4402
at Twig_Template->displayWithErrorHandling(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array('hwi_oauth_content' => array(object(__TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e), 'block_hwi_oauth_content')))
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4372
at Twig_Template->display(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array('hwi_oauth_content' => array(object(__TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e), 'block_hwi_oauth_content')))
in E:\Projects\my_project\Symfony\app\cache\prod\twig\f3\c3\94f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e.php line 24
at __TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e->doDisplay(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array())
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4391
at Twig_Template->displayWithErrorHandling(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array())
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4372
at Twig_Template->display(array('error' => ''))
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4379
at Twig_Template->render(array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php line 53
at Symfony\Bridge\Twig\TwigEngine->render('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php line 79
at Symfony\Bundle\TwigBundle\TwigEngine->render('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine.php line 52
at Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine->render('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php line 108
at Symfony\Bundle\TwigBundle\TwigEngine->renderResponse('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\hwi\oauth-bundle\HWI\Bundle\OAuthBundle\Controller\ConnectController.php line 71
at HWI\Bundle\OAuthBundle\Controller\ConnectController->connectAction(object(Request))
in line
at call_user_func_array(array(object(ConnectController), 'connectAction'), array(object(Request)))
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2844
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2818
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2947
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2249
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in E:\Projects\my_project\Symfony\web\app.php line 23
[2] RuntimeException:没有名为'google'的资源所有者。 在n / a 在E:\ Projects \ my_project \ Symfony \ vendor \ hwi \ oauth-bundle \ HWI \ Bundle \ OAuthBundle \ Security \ OAuthUtils.php第220行
at HWI\Bundle\OAuthBundle\Security\OAuthUtils->getResourceOwner('google')
in E:\Projects\my_project\Symfony\vendor\hwi\oauth-bundle\HWI\Bundle\OAuthBundle\Security\OAuthUtils.php line 114
at HWI\Bundle\OAuthBundle\Security\OAuthUtils->getLoginUrl(object(Request), 'google')
in E:\Projects\my_project\Symfony\vendor\hwi\oauth-bundle\HWI\Bundle\OAuthBundle\Templating\Helper\OAuthHelper.php line 69
at HWI\Bundle\OAuthBundle\Templating\Helper\OAuthHelper->getLoginUrl('google')
in E:\Projects\my_project\Symfony\vendor\hwi\oauth-bundle\HWI\Bundle\OAuthBundle\Twig\Extension\OAuthExtension.php line 63
at HWI\Bundle\OAuthBundle\Twig\Extension\OAuthExtension->getLoginUrl('google')
in E:\Projects\my_project\Symfony\app\cache\prod\twig\f3\c3\94f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e.php line 46
at __TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e->block_hwi_oauth_content(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array())
in line
at call_user_func(array(object(__TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e), 'block_hwi_oauth_content'), array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array())
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4339
at Twig_Template->displayBlock('hwi_oauth_content', array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array('hwi_oauth_content' => array(object(__TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e), 'block_hwi_oauth_content')))
in E:\Projects\my_project\Symfony\app\cache\prod\twig\c5\58\f7730812ef8717461bfd2081b2ec682a7210fca6c5a4d0e2ce5a1de9cab2.php line 29
at __TwigTemplate_c558f7730812ef8717461bfd2081b2ec682a7210fca6c5a4d0e2ce5a1de9cab2->doDisplay(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array('hwi_oauth_content' => array(object(__TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e), 'block_hwi_oauth_content')))
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4391
at Twig_Template->displayWithErrorHandling(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array('hwi_oauth_content' => array(object(__TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e), 'block_hwi_oauth_content')))
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4372
at Twig_Template->display(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array('hwi_oauth_content' => array(object(__TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e), 'block_hwi_oauth_content')))
in E:\Projects\my_project\Symfony\app\cache\prod\twig\f3\c3\94f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e.php line 24
at __TwigTemplate_f3c394f478b279ade4dd2d3ac458b9a9dd4ddb7db22da21707e88d9a5885896e->doDisplay(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array())
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4391
at Twig_Template->displayWithErrorHandling(array('error' => '', 'assetic' => array('debug' => true, 'vars' => object(ValueContainer), 'use_controller' => false), 'app' => object(GlobalVariables)), array())
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4372
at Twig_Template->display(array('error' => ''))
in E:\Projects\my_project\Symfony\app\cache\prod\classes.php line 4379
at Twig_Template->render(array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bridge\Twig\TwigEngine.php line 53
at Symfony\Bridge\Twig\TwigEngine->render('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php line 79
at Symfony\Bundle\TwigBundle\TwigEngine->render('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine.php line 52
at Symfony\Bundle\TwigBundle\Debug\TimedTwigEngine->render('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\symfony\symfony\src\Symfony\Bundle\TwigBundle\TwigEngine.php line 108
at Symfony\Bundle\TwigBundle\TwigEngine->renderResponse('HWIOAuthBundle:Connect:login.html.twig', array('error' => ''))
in E:\Projects\my_project\Symfony\vendor\hwi\oauth-bundle\HWI\Bundle\OAuthBundle\Controller\ConnectController.php line 71
at HWI\Bundle\OAuthBundle\Controller\ConnectController->connectAction(object(Request))
in line
at call_user_func_array(array(object(ConnectController), 'connectAction'), array(object(Request)))
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2844
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2818
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2947
at Symfony\Component\HttpKernel\DependencyInjection\ContainerAwareHttpKernel->handle(object(Request), '1', true)
in E:\Projects\my_project\Symfony\app\bootstrap.php.cache line 2249
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in E:\Projects\my_project\Symfony\web\app.php line 23
答案 0 :(得分:8)
如果您想正确配置oauth,上述已接受的解决方案将无效。
以下是解决方案:
resource_owners:
下的密钥,例如resowner_key1:
必须与config.yml
和security.yml
文件匹配,如下所示。
在config.yml
文件中
hwi_oauth:
# name of the firewall in which this bundle is active, this setting MUST be set
firewall_name: open_auth
resource_owners:
resowner_key1:
type: facebook #e.g. facebook, google
client_id: <client_id>
client_secret: <secret_id>
options:
display: popup #dialog is optimized for popup window
并在security.yml
open_auth:
anonymous: ~
oauth:
resource_owners:
resowner_key1: "/login/check-facebook"
login_path: /login
use_forward: false
failure_path: /login
oauth_user_provider:
service: fos_user_provider
答案 1 :(得分:2)
检查您的安全配置文件(app / config / security.yml)并从resource_owners部分下删除“google”