0
votes

I am working on social networks login/registration for my application.

I have used HWIOAUTHBUNDLE. It was working fine for my development server but I have uploaded my code to my live server it gives me following error :

Unable to find the controller for path "/oauth-login/check-google". Maybe you forgot to add the matching route in your routing configuration?

I am sharing with you my configurations files:

routing.yml

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

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

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

linkedin_login:
    pattern: /oauth-login/check-linkedin

twitter_login:
    pattern: /oauth-login/check-twitter
google_login:
    pattern: /oauth-login/check-google

security.yml

security:
    providers:
        chain_provider:
            chain:
                providers: [fos_userbundle, oauth_user_provider]
        fos_userbundle:
            id: fos_user.user_provider.username_email
        oauth_user_provider:
            id: myapp.oauth.user.provider
    encoders:
        FOS\UserBundle\Model\UserInterface: sha512

    firewalls:

        admin:
            pattern:    ^/admin
            form_login:
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
                check_path: /admin/login_check
                login_path: /admin/login
                default_target_path: /admin/dashboard
                always_use_default_target_path: true
            logout:
                path:   /admin/logout
            anonymous: ~

        main:
            pattern: ^/
            context: shared_login_context
            form_login:
                provider: fos_userbundle
                csrf_provider: form.csrf_provider
                check_path: /login_check
                login_path: /login
                default_target_path: /flashboard   
                always_use_default_target_path: true
                success_handler: myapp.user.login_success_handler
            logout:       true
            anonymous:    true
            remember_me:
                key:      XXX
                lifetime: 604800

        hwi_oauth:
            context: shared_login_context
            pattern: ^/oauth-login/?$
            oauth:
                resource_owners:
                    linkedin:           "/oauth-login/check-linkedin"
                    twitter:            "/oauth-login/check-twitter"
                    google:            "/oauth-login/check-google"
                login_path:        /connect
                failure_path:      /login

                oauth_user_provider:
                    service: myapp.oauth.user.provider

config.yml

hwi_oauth:
    connect:
        confirmation: true
    firewall_name: hwi_oauth
    target_path_parameter: "target_path"
    http_client:
        timeout: 60
    fosub:
        username_iterations: 30
        properties:
            linkedin: linkedinId
            twitter: twitterId
    resource_owners:
        linkedin:
            type:                linkedin
            client_id:           XXX
            client_secret:       XXX
            scope:               XXX
        twitter:
            type:                twitter
            client_id:           XXX
            client_secret:       XXX
        google:
            type:                google
            client_id:           XXX
            client_secret:       XXX
            scope:               XXX
1
Do the other providers work? - benlumley
No for every provider it gives error. problem is it is working fine in development server... - Muhammad Umair

1 Answers

0
votes

Change your login_path to

/oauth-login

in your security.yml file.