Search code examples
symfonyhwioauthbundle

HWIOAuthBundle Symfony2 facebook login route name


Where do I find the route name for logging in with facebook? I don't want to hardcode the routes into the twig templates.


Solution

  • Short answer

    Route name is hwi_oauth_service_redirect:

    Name                                Method   Scheme Host Path
    hwi_oauth_service_redirect          ANY      ANY    ANY  /connect/{service}
    

    So, for facebook you can generate connect route in view via:

    {{ path('hwi_oauth_service_redirect', { service: 'facebook' }) }}
    

    How to debug similar problems

    I was also amazed how HWIOAuthBundle doesn't mention route name in documentation anywhere, or at least it isn't obviously stated and I couldn't find it.

    When you have this kind of problem, you can use $ app/console router:debug command, which will provide you dump of all routes defined.