1

I've been fighting the whole day with HWIOAuthBundle, and I just can't get it do what I need.

I want oauth-only login, so no form login, no registration, everything goes through oauth. I want to create new user accounts automatically on their first login with the profile data I get from oauth. I want to not use FOS UserBundle, because I don't see what functionality it offers me that I really need in my scenario (I'm using it in other projects).

Now I implemented my own User Provider, inheriting from the included EntityUserProvider, I throw exceptions in every method just to see where the heck it's getting the user data from, and none of them gets triggered.

So I officially give up and ask the community for help. Here are my configs:

security:

providers:
    oauth:
        id:             campfire.user_provider

firewalls:
    # disables authentication for assets and the profiler, adapt it according to your needs
    dev:
        pattern: ^/(_(profiler|wdt)|css|images|js)/
        security: false

    secured_area:
        anonymous: ~
        oauth:
            resource_owners:
                facebook:       "/login/check-facebook"
                google:         "/login/check-google"
            login_path:         /login/
            use_forward:        false
            failure_path:       /login/

            oauth_user_provider:
                oauth:          ~

access_control:
    - { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }



services:

  campfire.user_provider:
    class:      CampfireBundle\Security\OAuthUserProvider
    arguments:  ["@doctrine", CampfireBundle\Entity\Author, {facebook: facebook_id, google: google_id}]

config.yml is set up according to the docs, not posting it because it contains my client IDs and secrets.

What am I doing wrong that it's apparently not even calling my User Provider?

Tom
  • 2,688
  • 3
  • 29
  • 53

1 Answers1

1

I'm afraid I gave up on HWIOAuthBundle a long time ago as nearly impossible to develop against. Thankfully, with the new Guard component, it's a lot easier. I've used the following package and example code files to implement a Login with Linkedin on a site, with the form used to allow for a confirmation/choice of username, but it could be done away with, if you accept the name provided form the OAuth source.

Alister Bulman
  • 34,482
  • 9
  • 71
  • 110
  • I think Guard is much easier to implement, so even though this doesn't answer the question directly, it's probably the best answer. – Tom Sep 29 '16 at 21:03