I installed HWIOAuthBundle and did everything as it is said here : https://gist.github.com/danvbe/4476697

But I have this error when I try to go here : "/login/google"

No resource owner with name 'google'.

And I have the same kind of errror with the others API : yahoo, linkedin, windows_live

I don't know why since I have completed well security.yml :

jms_security_extra:
secure_all_services: false
expressions: true

security:
    encoders:
        Symfony\Component\Security\Core\User\User: plaintext
        FOS\UserBundle\Model\UserInterface: sha512

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

providers:
        fos_userbundle:
            id: fos_user.user_provider.username_email

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

    main:
        pattern: ^/                         
        form_login:                            
            provider: fos_userbundle        
            remember_me: true                  
            csrf_provider: form.csrf_provider
            login_path: /login
            check_path: /login_check
        remember_me:
            key: %secret%                      
        anonymous: true
        logout: true                                         
        oauth:
            resource_owners:
                yahoo:              "/login/check-yahoo"
                google:             "/login/check-google"
                windows_live:       "/login/check-windows_live"
                linkedin:           "/login/check-linkedin"
            login_path:        /login
            failure_path:      /login
            oauth_user_provider:
                service: my_user_provider
        logout:
            path: /logout
            target: /
    login:
        pattern:  ^/login$
        security: false

        remember_me:
            key: "%secret%"
            lifetime: 31536000 # 365 days in seconds
            path: /
            domain: ~ # Defaults to the current domain from $_SERVER

access_control:
    - { path: ^/$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/login$, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/profile, roles: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/(search|contact|myprofile), roles: ROLE_USER }

And also config.yml :

imports:
- { resource: parameters.yml }
- { resource: security.yml }
- { resource: "@MyprojectUserBundle/Resources/config/services.yml" }

#[..]

fos_user:
    db_driver: orm
    firewall_name: main
    user_class: Uvaluo\UserBundle\Entity\User
    registration:
        form:
            type: uvaluo_user_registration
        confirmation:
            enabled: true
            template: FOSUserBundle:Registration:email.txt.twig

hwi_oauth:
    connect:
        account_connector: my_user_provider
    firewall_name: main
    fosub:
        username_iterations: 30
        properties:
            yahoo: yahoo_id
            google: google_id
            windows_live: windows_live_id
            linkedin: linkedin_id
    resource_owners:
        any_name:
            type:                yahoo
            client_id:           X
            client_secret:       X
        any_name:
            type:                google
            client_id:           X
            client_secret:       X
            scope:               "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"    
        any_name:
            type:                windows_live
            client_id:           X
            client_secret:       X
        any_name:
            type:                linkedin
            client_id:           X
            client_secret:       X
            scope:               r_basicprofile

I have set all the resources owner so I don't know why I get this error.

有帮助吗?

解决方案

I found the error, I forgot to replace "any_name" by google, yahoo, linkedin, windows_live

其他提示

For me it was wrongly configured resource_owners in security.yml

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top