src/Controller/Front/SocialController.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Front;
  3. use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\RedirectResponse;
  6. class SocialController extends AbstractController
  7. {
  8.     private ClientRegistry $clientRegistry;
  9.     public function __construct(ClientRegistry $clientRegistry)
  10.     {
  11.         $this->clientRegistry $clientRegistry;
  12.     }
  13.     public function facebookStart(): RedirectResponse
  14.     {
  15.         // will redirect to Facebook!
  16.         return $this->clientRegistry
  17.             ->getClient('facebook_main')
  18.             ->redirect([
  19.                 'public_profile''email',
  20.             ]);
  21.     }
  22.     public function facebookCheck()
  23.     {
  24.     }
  25.     public function googleStart(): RedirectResponse
  26.     {
  27.         // Redirect to google
  28.         return $this->clientRegistry->getClient('google')->redirect([], []);
  29.     }
  30.     public function googleCheck()
  31.     {
  32.     }
  33. }