小编Jac*_*ser的帖子

使用带有FOSUserBundle的HWIOAuthBundle时出现"无法找到用户名"错误

难倒在这里.使用HWIOAuthBundle允许在Symfony3上使用FOSUserBundle进行社交登录.

使用用户名和密码功能登录正常,但在使用社交登录(在我的情况下,Facebook和LinkedIn)进行身份验证时,会在重定向到登录页面时返回错误"无法找到用户名".

有任何想法吗?

相关文件的相关部分:

config.yml

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: AppBundle\Entity\User

hwi_oauth:
    firewall_names: [secured_area]
    connect:
        account_connector: hwi_oauth.user.provider.fosub_bridge
        confirmation: true
    resource_owners:
        facebook:
            type:                facebook
            client_id:           xxx
            client_secret:       xxx
        linkedin:
            type:                linkedin
            client_id:           xxx
            client_secret:       xxx
    fosub:
        username_iterations: 30
        properties:
            facebook: facebookId
            linkedin: linkedinId
Run Code Online (Sandbox Code Playgroud)

security.yml

security:
    encoders:
        FOS\UserBundle\Model\UserInterface: bcrypt

    role_hierarchy:
        ROLE_ADMIN:       ROLE_USER
        ROLE_SUPER_ADMIN: ROLE_ADMIN

    providers:
        fos_userbundle:
            id: fos_user.user_provider.username

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

        secured_area:
            anonymous: ~
            form_login:
                provider: fos_userbundle
                csrf_token_generator: security.csrf.token_manager
            oauth:
                resource_owners:
                    facebook:   "/login/check-facebook"
                    linkedin:   "/login/check-linkedin"
                login_path:     /login
                use_forward: …
Run Code Online (Sandbox Code Playgroud)

php symfony fosuserbundle hwioauthbundle

5
推荐指数
1
解决办法
1173
查看次数

标签 统计

fosuserbundle ×1

hwioauthbundle ×1

php ×1

symfony ×1