8

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?

zizoujab
  • 7,603
  • 8
  • 41
  • 72
Wirata Adidharma
  • 135
  • 4
  • 11

3 Answers3

21

Add to security.yml

providers:                             
    hwi:                               
        id: hwi_oauth.user.provider    

or your custom user provider service

Markus Kottländer
  • 8,228
  • 4
  • 37
  • 61
SilvioQ
  • 1,972
  • 14
  • 26
  • In the version 2.0 Beta2, I had to put `hwi_oauth.user.provider` instead of `hwi`, otherwise I got an `Invalid firewall "main": user provider "hwi_oauth.user.provider" not found.` exception – zeykzso Aug 19 '22 at 07:02
3

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
Radek
  • 263
  • 3
  • 10
-1

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 }