Wirata Adidharma
Wirata Adidharma

Reputation: 135

Symfony2 - HWI/OAuthBundle can't find user provider

Trying to connect facebook using HWI/OAuthBundle, following all of the steps that say in HWI/OauthBundle Doc, but it return error

There is no user provider for user "HWI\Bundle\OAuthBundle\Security\Core\User\OAuthUser"

Does anyone can explain for me why this happen and how to fix this problem?

Upvotes: 8

Views: 3482

Answers (3)

Gulzada Serzhan
Gulzada Serzhan

Reputation: 67

This exception appears when services.yml is put below security.yml in config.yml. Apparently, hwi_oauth service has to be defined before it's going to be used in security providers. So the correct sequence of resources in config.yml is supposed to be:

 
         - { resource: services.yml }
         - { resource: security.yml }
    

Upvotes: -1

SilvioQ
SilvioQ

Reputation: 2072

Add to security.yml

providers:                             
    hwi:                               
        id: hwi_oauth.user.provider    

or your custom user provider service

Upvotes: 21

Radek
Radek

Reputation: 263

Above is almost correct. It should be added to security.yml not services.yml. See below for example in context.

providers:
    in_memory:
        memory:
            users:
                admin: { password: somesecretpassowrd, roles: 'ROLE_ADMIN' }
    hwi:                               
        id: hwi_oauth.user.provider

Upvotes: 3

Related Questions