Kubadev
Kubadev

Reputation: 865

HWIOAuthBundle : No resource owner with name 'check-google'

I installed HWIOAuthBundle.

But I have this error when I try to login with Google Account :

No ressource owner with name 'check-google'.

And I have the same kind of errror with the others API (Facebook, twitter...)

This is my security.yml :

firewalls:
    main:
        pattern:  ^/login$
        security: true
        anonymous: true
        provider: user_provider
        form_login:
            login_path: fos_user_security_login
            check_path: fos_user_security_check
        logout:
            path:   fos_user_security_logout
            target: /
        oauth:
            resource_owners:
                facebook:           "/login/check-facebook"
                google:             "/login/check-google"
                twitter:            "/login/check-twitter"
                linkedin:           "/login/check-linkedin"
            login_path:        /login
            check_path:        /login
            failure_path:      /login

            oauth_user_provider:
                #this is my custom user provider, created from FOSUBUserProvider - will manage the
                #automatic user registration on your site, with data from the provider (facebook. google, etc.)
                service: my_user_provider

My routing.yml :

#HWIOAuthBundle routes
    hwi_oauth_security:
    resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
    prefix: /connect/by

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

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

facebook_login:
    pattern: /login/check-facebook
    options: { i18n: false }

google_login:
    pattern: /login/check-google
    options: { i18n: false }

twitter_login:
    pattern: /login/check-twitter

linkedin_login:
    pattern: /login/check-linkedin

and my config.yml :

# HWIOAuthBundle
hwi_oauth:
    connect:
        account_connector: my_user_provider
    firewall_name: main
    fosub:
        username_iterations: 30
        properties:
            # these properties will be used/redefined later in the custom FOSUBUserProvider service.
            facebook: facebook_id
            google: google_id
            twitter: twitter_id
            linkedin: linkedin_id
    resource_owners:
        facebook:
            type:                facebook
            client_id:           xxxxx
            client_secret:       xxxxx
            scope:               ""
            options:
                display: popup
        google:
            type:                google
            client_id:           xxxx
            client_secret:       xxxx
            scope:               "https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile"
        twitter:
            type:                twitter
            client_id:           xxxx
            client_secret:       xxxx
            scope:               ""
        linkedin:
            type:                linkedin
            client_id:           xxxx
            client_secret:       xxxx
            scope:               "r_basicprofile"

services:
    hwi_oauth.user.provider.entity:
        class: HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUserProvider
    cmf_create.persistence.orm.object_mapper:
        class: Midgard\CreatePHP\Mapper\DoctrineOrmMapper
        arguments:
            - "%cmf_create.map%"
            - "@doctrine"

My problem is same than No resource owner with name 'google' (HWIOAuthBundle & FOSUserBundle integration). How can i fix this ?

Upvotes: 1

Views: 2974

Answers (3)

Kubadev
Kubadev

Reputation: 865

I resolved this issue. I found this link helpfull :

http://m2mdas.github.io/blog/2013/11/21/integrate-hwioauthbundle-with-fosuserbundle/

In the above link, After I added cacert.pem to the path, it resolved the issue.

HWIOAuthBundle uses Buzz curl client to communicate with web services. Buzz by default enables SSL certificate check. On some server CA certificate information may not exist. To add CA certificate info download cacert.pem from this page and set curl.cainfo php ini variable to the location of cacert.pem e.g curl.cainfo = /path/to/cacert.pem

and I missed the above step.

Regards,

Mk6ix

Upvotes: 0

user3125651
user3125651

Reputation: 11

I have been running into the same issue:

No ressource owner with name 'check-google'.

For me it was solved by changing the routing.yml to this:

google_login:
    pattern: /api/login/check/google

Upvotes: 1

LPodolski
LPodolski

Reputation: 2878

my best bet is that your firewall is not active on "login with *" URLs

try change:

pattern:  ^/login$

I personaly use firewall to all URLs:

pattern: ^/

and explicitly set public urls:

access_control:
    - { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
    - { path: ^/admin/, role: ROLE_ADMIN }
    - { path: ^/add, role: ROLE_USER }

Upvotes: 1

Related Questions