hwi / HWIOAuthBundle

OAuth client integration for Symfony. Supports both OAuth1.0a and OAuth2.
MIT License
2.27k stars 798 forks source link

Error "Unable to find the controller for path …The route is wrongly configured." . How to configure the "check" Controller ? #1924

Open damienfa opened 2 years ago

damienfa commented 2 years ago
Q A
Bug? no
New Feature? no
Support question? yes
Version 2.x

My question

I don't understand that part of the documentation. Those routes are declared but do not target to any controller. Is this normal? (see here) image

My case and my issue

I confirmed everything as indicated in the documentation for Azure (resource owner). See below my security.yaml, hwi_oauth.yaml…

I successfully manage to be redirected to Azure in order to log in and, once logged, to be redirected back to my application on the "/login/check-azure" route (as indicated in my security.yaml). The reply URL looks well in my browser : http://localhost/login/check-azure?code=0.ATEA41mpfLamBE6PWLnLKh_fKxxxxxxxxx

⚠️ But I've got the Symfony error : "Unable to find the controller for path "/login/check-azure". The route is wrongly configured." This does not surprise me too much because at no time is the controller defined for this route. What part am I missing? 🤔

Thanks for your help

My config files

_routes/hwi_oauthrouting.yaml :

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

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

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

azure_login:
    path: /login/check-azure

_config/hwioauth.yaml :

hwi_oauth:
    # list of names of the firewalls in which this bundle is active, this setting MUST be set
    firewall_names: [main]
    # https://github.com/hwi/HWIOAuthBundle/blob/master/Resources/doc/2-configuring_resource_owners.md
    resource_owners:
        azure:
            type: azure
            client_id: 70a35xxx-xxxx-xxxx-xxxx-xxxx 
            client_secret: xxxxxxxxxxxxxxx
            redirect_uri: xxxxxxxx
            options:
                application: xxxxxxxx
                scope: https://graph.microsoft.com/User.Read

config/security.yaml :

security:
    providers:
        users:
            entity:
                class: App\Entity\User
                property: email
    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            pattern: ^/
            # Azure SSO (Oauth) 
            oauth:
                resource_owners:
                    azure: "/login/check-azure"
                login_path: "/redirect/azure"
                use_forward: false
                failure_path: "/login"

                oauth_user_provider:
                    service: App\Service\Security\AzureSamlUserProviderService
github-actions[bot] commented 8 months ago

Message to comment on stale issues. If none provided, will not mark issues stale

timwhite commented 2 months ago

I was having a similar issue. It just needs to be an empty route like this (mine was in routes.yml):

azure_login:
    path: /login/check-azure

It gets picked up by a listener. It's important that client secret keys are defined though.