2
votes

I try 10 times to find out how to install HWIOAuthBundle But there is no enough documentation, I install the Bundle and I follow exactly the documentation in Git But it shows me this error:

InvalidConfigurationException: Unrecognized options "anonymous" under "security.firewalls.secured_area.oauth"

Somehow I didn't understand the Part A) 'Have a user provider that implements'.What should I do?Or where can I find easy documentation

A) Have a user provider that implements OAuthAwareUserProviderInterface

The bundle needs a service that is able to load users based on the user response of the oauth endpoint. If you have a custom service it should implement the interface: HWI\Bundle\OAuthBundle\Security\Core\User\OAuthAwareUserProviderInterface.

The HWIOAuthBundle also ships with three default implementations:

    OAuthUserProvider (service name: hwi_oauth.user.provider) - doesn't persist users
    EntityUserProvider (service name: hwi_oauth.user.provider.entity) - loads users from a database
    FOSUserBundle integration (service name: hwi_oauth.user.provider.fosub_bridge). Checkout the documentation for integrating HWIOAuthBundle with FOSUserBundle for more information: (todo)

what should I do here ?

3
Seems you have some issue in security.yml, can you edit and add it here? - stloyd
I just copied and pasted this what in the documentation but I didn't understand the A part and I didn't do nothing as a service etc. here is the link: github.com/hwi/HWIOAuthBundle/blob/0.2/Resources/doc/… - Momo1987

3 Answers

1
votes

You should replace/comment out the line of the service:

oauth_user_provider:
    service: my.oauth_aware.user_provider.service

and then replace by:

oauth_user_provider:
    oauth: ~

Source: https://github.com/hwi/HWIOAuthBundle/issues/72

Go further:

0
votes

Ahh, seems like a typo in docs, could you move that anonymous 4 spaces lower to something like:

# app/config/security.yml
security:
    firewalls:
        secured_area:
            anonymous: ~
            oauth:
                resource_owners:
                    facebook:      "/login/check-facebook"
                login_path:        /login
                failure_path:      /login

                oauth_user_provider:
                    service: my.oauth_aware.user_provider.service
0
votes

Easy fix for this is to define a service like this :

In security.yml keep this :

oauth_user_provider:
                service: my.oauth_aware.user_provider.service

In services.yml put this :

services:
my.oauth_aware.user_provider.service:
        class: HWI\Bundle\OAuthBundle\Security\Core\User\FOSUBUserProvider
        arguments:
            userManager: "@fos_user.user_manager"
            properties: ["pass properties as array"]

Thats it !