The service does not start: the controller should return a response (null)

Hi everyone and many thanks for the help, I'm trying to get FOSFacebook to work, but so far it seems impossible. I tried a lot of settings, and a lot of fixes, but nothing worked for me.

Here is my configuration:

security.yml

chain_provider: chain: providers: [fos_userbundle, fos_facebook_provider] fos_userbundle: id: fos_user.user_provider.username fos_facebook_provider: id: fos.facebook.custom_provider firewalls: dev: pattern: ^/(_(profiler|wdt)|css|images|js)/ security: false main: pattern: ^/ form_login: login_path: fos_user_security_login check_path: fos_user_security_check provider: fos_userbundle csrf_provider: form.csrf_provider logout: true anonymous: true public: pattern: ^/ fos_facebook: app_url: "http://apps.facebook.com/myApp/" server_url: "http://www.mywebsite.com" login_path: /facebook/login check_path: /facebook/check default_target_path: / provider: fos_facebook_provider anonymous: false logout: handlers: ["fos_facebook.logout_handler"] 

config.yml

 fos.facebook.custom_provider: class: Bundles\UserBundle\Security\User\Provider\FacebookProvider arguments: facebook: "@fos_facebook.api" userManager: "@fos_user.user_manager" validator: "@validator" container: "@service_container" fos_facebook: file: %kernel.root_dir%/../vendor/facebook/php-sdk/src/base_facebook.php alias: facebook app_id: myid secret: mysecret cookie: true permissions: [email] 

routing.yml

  _security_check: pattern: /facebook/check _security_logout: pattern: /logout 

Twig Template

 <script type="text/javascript"> function goLogIn(){ window.location.href = "{{ path('_security_check') }}"; } function onFbInit() { if (typeof(FB) != 'undefined' && FB != null ) { FB.Event.subscribe('auth.statusChange', function(response) { if (response.session || response.authResponse) { setTimeout(goLogIn, 500); } else { window.location.href = "{{ path('_security_logout') }}"; } }); } } </script> {{ facebook_initialize({'xfbml': true, 'fbAsyncInit': 'onFbInit();'}) }} 

UserController.php

  * @Route("/facebook/check") */ public function loginCheckFacebookAction(){ } 

Both the provider and the modification of the User class (as in the Readme ).

But the problem is that the service was not called. Indeed, the method in UserController must be a dummy method, and here it is not. This method is called and, of course, I get this error:

LogicException: The controller should return a response (null). Have you forgotten to add a return statement to your controller? (uncaught exception).

What is my mistake?

+1
source share
1 answer

Remove route / action UserController loginCheckFacebookAction

+1
source

Source: https://habr.com/ru/post/907110/


All Articles