Symfony3 Facebook Login - redirect_uri URL gets converted to relative Symfony3 Facebook Login - redirect_uri URL gets converted to relative symfony symfony

Symfony3 Facebook Login - redirect_uri URL gets converted to relative


Are you using version 1.x of league/oauth2-client (you can check in composer.lock)? That ignores the redirect_uri in getAuthorizationUrl and uses the one you pass in the constructor. If you're using that version, change the definition for app.facebook_provider to read

redirectUri: "@=service('router').generate('connect_facebook_check', {}, 0)"

Note the 0 instead of true. The UrlGeneratorInterface constants have changed in 2.8.


I think your problem is that you're missing the request context in your service. Have a look at:http://symfony.com/doc/current/console/request_context.html

You could pass it the request and then do something like:

$context = new RequestContext();$context->fromRequest($this->requestStack->getCurrentRequest());$this->router->setContext($context);$this->router->generate('connect_facebook_check', array(), RouterInterface::ABSOLUTE_URL);