简体   繁体   English

Symfony 3.3(HWIOAuthBundle + FOSUserBundle)在参数中找到无效的密钥“ user_manager”

[英]Symfony 3.3 ( HWIOAuthBundle + FOSUserBundle) Invalid key “user_manager” found in arguments

I've just updated to Symfony 3.3 and now I get that error message : 我刚刚更新到Symfony 3.3,现在收到该错误消息:

Invalid key "user_manager" found in arguments of method "__construct()" for service "app.fos_user.oauth_provider": only integer or $named arguments are allowed. 在服务“ app.fos_user.oauth_provider”的方法“ __construct()”的参数中发现无效的键“ user_manager”:仅允许使用整数或$ named参数。

I don't understand the reason for that issue, here is my configuration : 我不知道该问题的原因,这是我的配置:

service.yml # app/config/service.yml service.yml#app / config / service.yml

app.fos_user.oauth_provider:
        class: EC\UserBundle\Entity\FOSUBUserProvider
        arguments:
            user_manager: "@fos_user.user_manager"
            user_response:
                facebook: facebook_id

config.yml 配置文件

# app/config/config.yml

# FOSUserBundle Configuration
fos_user:
    db_driver: orm 
    firewall_name: main 
    user_class: EC\UserBundle\Entity\User 
    use_username_form_type: false

    registration:
        form:
            type: EC\UserBundle\Form\RegistrationType
    profile:
        form:
            type: EC\UserBundle\Form\ProfileFormType

    from_email:
        address: contact@xxxxxxxx.fr
        sender_name: xxxxxxxxx

#HWIOAuthBundle
hwi_oauth:
    firewall_names: ["main"]
    fosub:
        username_iterations: 30
        properties:
            facebook: facebook_id
    resource_owners:

        facebook:
            type:           facebook
            client_id:      "%facebook_client_id%"
            client_secret:  "%facebook_secret%"
            scope:         email
            infos_url:     "https://graph.facebook.com/me?fields=id,email,gender,last_name,first_name,birthday,picture.type(square)"
            options:
                crsf: true

security.yml 安全性

# app/config/security.yml
security:

    encoders:
        EC\UserBundle\Entity\User: sha512

    role_hierarchy:
        ROLE_ADMIN: ROLE_USER
        ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWER_TO_SWITCH]


    providers:
        main:
            id: fos_user.user_provider.username_email

    firewalls:

        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        main:
            pattern: ^/
            anonymous: true

            provider: main

            form_login: 
                login_path: fos_user_security_login
                check_path: fos_user_security_check

            logout:
                path: fos_user_security_logout
                target: /

            remember_me:
                secret: %secret% 

            #HWIOAuthBundle
            oauth:
                resource_owners:
                    facebook: "/connect/check-facebook"

                login_path:     /login
                failure_path:   /login

                oauth_user_provider:
                    service: app.fos_user.oauth_provider

Before everything worked well. 在一切正常之前。

Thank you for helping me. 感谢你们对我的帮助。

Your service is not well-organized since you should pass as arguments fos.user_manager service, and facebook . 您的服务井井有条,因为您应该将fos.user_manager服务和facebook作为参数传递。

Try to edit the user provider in your service.yml to be something like: 尝试将service.yml中的用户提供程序编辑为:

hwi_oauth.user.provider.entity:
    class: EC\UserBundle\Entity\FOSUBUserProvider
    #this is the place where the properties are passed to the UserProvider - see config.yml
    arguments: ['@fos_user.user_manager',{facebook: facebook_id}]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM