title: how can I login with facebook from localhost. (Symfony)
body: <p>I am using symfony. I have to create programme for facebook login. I created on class and in that create two function first is for generating link and other is callback function. <br><br>
       In controller created one action name is indexAction, in that object of class present. But when we run programme using link as <a href="http://localhost/symfony-demo-project/web/app_dev.php/login" rel="nofollow">http://localhost/symfony-demo-project/web/app_dev.php/login</a> on browser it gives Error like:<br><br>
      The autoloader expected class "Btit\Bundle\CommonBundle\facebook\facebookLogin" to be defined in file "/var/www/html/symfony-demo-project/src/Btit/Bundle/CommonBundle/facebook/facebookLogin.php". The file was found but the class was not in it, the class name or namespace probably has a typo.</p>
  
  <pre><code>&lt;?php
  
      namespace Btit\Bundle\CommomBundle\facebook;
  
      use Facebook\Facebook;
  
  
          $fb = new Facebook/Facebook([
                  'app_id' =&gt; '1622871987981966',
                  'app_secret' =&gt; '6a15b7ae9e4409b6d33553ed3ed61f95',
                  'default_graph_version' =&gt; 'v2.2',
          ]);
  
          $helper = $fb-&gt;getRedirectLoginHelper();
  
          $permissions = ['email']; // Optional permissions
          $loginUrl = $helper-&gt;getLoginUrl('https://localhost/symfony-demo-project/app-dev.php/login/', $permissions);
  
          echo '&lt;a href="' . htmlspecialchars($loginUrl) . '"&gt;Log in with Facebook!&lt;/a&gt;';
  
      }
  
      function Callback()
      {
          $fb = new Facebook/Facebook([
                  'app_id' =&gt; '1622871987981966',
                  'app_secret' =&gt; '6a15b7ae9e4409b6d33553ed3ed61f95',
                  'default_graph_version' =&gt; 'v2.2',
          ]);
  
          $helper = $fb-&gt;getRedirectLoginHelper();
  
          try {
              $accessToken = $helper-&gt;getAccessToken();
          } catch(Facebook\Exceptions\FacebookResponseException $e) {
              // When Graph returns an error
              echo 'Graph returned an error: ' . $e-&gt;getMessage();
              exit;
          } catch(Facebook\Exceptions\FacebookSDKException $e) {
              // When validation fails or other local issues
              echo 'Facebook SDK returned an error: ' . $e-&gt;getMessage();
              exit;
          }
  
          if (! isset($accessToken)) {
              if ($helper-&gt;getError()) {
                  header('HTTP/1.0 401 Unauthorized');
                  echo "Error: " . $helper-&gt;getError() . "\n";
                  echo "Error Code: " . $helper-&gt;getErrorCode() . "\n";
                  echo "Error Reason: " . $helper-&gt;getErrorReason() . "\n";
                  echo "Error Description: " . $helper-&gt;getErrorDescription() . "\n";
              } else {
                  header('HTTP/1.0 400 Bad Request');
                  echo 'Bad request';
              }
              exit;
          }
  
          // Logged in
          echo '&lt;h3&gt;Access Token&lt;/h3&gt;';
          var_dump($accessToken-&gt;getValue());
  
          // The OAuth 2.0 client handler helps us manage access tokens
          $oAuth2Client = $fb-&gt;getOAuth2Client();
  
          // Get the access token metadata from /debug_token
          $tokenMetadata = $oAuth2Client-&gt;debugToken($accessToken);
          echo '&lt;h3&gt;Metadata&lt;/h3&gt;';
          var_dump($tokenMetadata);
  
          // Validation (these will throw FacebookSDKException's when they fail)
          $tokenMetadata-&gt;validateAppId($config['app_id']);
          // If you know the user ID this access token belongs to, you can validate it here
          //$tokenMetadata-&gt;validateUserId('123');
          $tokenMetadata-&gt;validateExpiration();
  
          if (! $accessToken-&gt;isLongLived()) {
              // Exchanges a short-lived access token for a long-lived one
              try {
                  $accessToken = $oAuth2Client-&gt;getLongLivedAccessToken($accessToken);
              } catch (Facebook\Exceptions\FacebookSDKException $e) {
                  echo "&lt;p&gt;Error getting long-lived access token: " . $helper-&gt;getMessage() . "&lt;/p&gt;\n\n";
                  exit;
              }
  
              echo '&lt;h3&gt;Long-lived&lt;/h3&gt;';
              var_dump($accessToken-&gt;getValue());
          }
  
          $_SESSION['fb_access_token'] = (string) $accessToken;
  
          // User is logged in with a long-lived access token.
          // You can redirect them to a members-only page.
          //header('Location: https://example.com/members.php');
      }
  
      }
      ?&gt;
  </code></pre>
  
  <p>Controller is like that</p>
  
  <pre><code>&lt;?php
  
  namespace Btit\Bundle\AppBundle\Controller;
  
  use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
  use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
  
  use Btit\Bundle\CommonBundle\facebook\facebookLogin;
  
  class LoginController extends Controller
  {
      /**
       * @Route("/login")
       * @Template()
       */
      public function indexAction()
      {
          $l = new facebookLogin;
          $l-&gt;LoginLink();
          $l-&gt;Callback();
          //return array();
  
      }   
  
  }
  ?&gt;
  </code></pre>
  
  <p>Give me solution for this error...</p>