为商店用户配置OAuth2访问权限

时间:2016-09-15 15:25:11

标签: symfony sylius hwioauthbundle

我想在我的Sylius商店添加社交连接按钮,但我无法做到这一点。 我通过composer安装了HWIOAuthBundle:

$ composer require hwi/oauth-bundle

然后,根据HWIOAuthBundle documentation,这是我的配置文件:

应用/配置/ routing.yml中

hwi_oauth_redirect:
    resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
    prefix:   /connect

hwi_oauth_connect:
    resource: "@HWIOAuthBundle/Resources/config/routing/connect.xml"
    prefix:   /connect

hwi_oauth_login:
    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
    prefix:   /login

facebook_login:
    path: /login/check-facebook

应用/配置/ config.yml

hwi_oauth:
    firewall_names: [secured_area]
    resource_owners:
        any_name:
            type:                facebook
            client_id:           <client_id>
            client_secret:       <client_secret>
            options:
                display: popup #dialog is optimized for popup window
                auth_type: rerequest # Re-asking for Declined Permissions

应用/配置/ security.yml

firewalls:
    secured_area:
        anonymous: ~
        oauth:
          resource_owners:
              facebook:           "/login/check-facebook"
          login_path:        /login
          use_forward:       false
          failure_path:      /login

          oauth_user_provider:
              service: sylius.oauth.user_provider

当我启动服务器时,出现此错误:

[Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException]                                              
The service "sylius.oauth.user_provider" has a dependency on a non-existent service "sylius.factory.admin_user_oauth".

你对如何解决它有任何想法吗? Sylius的文档非常简短,即使通过提交评论进行搜索,我也无法提供任何线索。

感谢您的帮助!

1 个答案:

答案 0 :(得分:0)

所以我会回答自己。 它似乎是一个错误,并且已经有一个拉取请求以便修复它: https://github.com/Sylius/Sylius/pull/5763