src/Controller/OAuthController.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use KnpU\OAuth2ClientBundle\Client\ClientRegistry;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\HttpFoundation\Request;
  6. use Symfony\Component\Routing\Annotation\Route;
  7. class OAuthController extends AbstractController
  8. {
  9.     #[Route('/connect/google'name'connect_google'methods: ['POST''GET'])]
  10.     public function connectGoogleAction(ClientRegistry $clientRegistry)
  11.     {
  12.         return $clientRegistry
  13.             ->getClient('google')
  14.             ->redirect(['openid''email'], []);
  15.     }
  16.     #[Route('/connect/facebook'name'connect_facebook'methods: ['POST''GET'])]
  17.     public function connectFacebookAction(ClientRegistry $clientRegistry)
  18.     {
  19.         return $clientRegistry
  20.             ->getClient('facebook')
  21.             ->redirect(['public_profile''email''user_birthday'], []);
  22.     }
  23.     #[Route('/connect/google/check'name'connect_google_check'methods: ['GET''POST'])]
  24.     public function connectGoogleCheckAction()
  25.     {
  26.     }
  27.     #[Route('/connect/facebook/check'name'connect_facebook_check'methods: ['GET''POST'])]
  28.     public function connectFacebookCheckAction()
  29.     {
  30.     }
  31. }