Ejemplo n.º 1
0
 public function loginPopupAction()
 {
     if ($this->request->attributes->has(SecurityContext::AUTHENTICATION_ERROR)) {
         $error = $this->request->attributes->get(SecurityContext::AUTHENTICATION_ERROR);
     } else {
         $error = $this->session->get(SecurityContext::AUTHENTICATION_ERROR);
     }
     $optionsFb = array('client_id' => $this->container->getParameter('facebook.app_id'), 'client_secret' => $this->container->getParameter('facebook.secret'), 'scope' => "email,read_friendlists");
     $optionsTwitter = array('client_id' => "qtaXFvCENUHX1aBbbIkKdw", 'client_secret' => 'xKq0QlYAuM4S1cBxfbmdDbGyIW2D7YLd0jjL0Vc46Y');
     $optionsLnkdin = array('client_id' => "74vdk3oig20m", 'client_secret' => '8zYxx4eJm8hK9tuU');
     $optionsYahoo = array('client_id' => "dj0yJmk9WHp5TlJubmJZNEIyJmQ9WVdrOVlsYzJSMk5ETldNbWNHbzlNVFUwTWpJMk1qazJNZy0tJnM9Y29uc3VtZXJzZWNyZXQmeD0zZg--", 'client_secret' => '8cc4661f009105a7d8749f1eccdc9b3e0e305ef4');
     //        $redirectUrl  ='http://dev.yourangelwishes.com/login/oauth/';
     $redirectUrl = 'http://aw.local/login/oauth/fb';
     $twitter = new TwitterResourceOwner(new \Buzz\Client\Curl(), new HttpUtils(), $optionsTwitter, 'twitter', new SessionStorage($this->request->getSession()));
     //        $lnkedIn = new LinkedinResourceOwner(new \Buzz\Client\Curl(), new HttpUtils(), $optionsLnkdin, 'linkedin', new SessionStorage($this->request->getSession()));
     $fb = new FacebookResourceOwner(new \Buzz\Client\Curl(), new HttpUtils(), $optionsFb, 'fb');
     //$yahoo   = new YahooResourceOwner(new \Buzz\Client\Curl(), new HttpUtils(), $optionsYahoo, 'yahoo', new SessionStorage($this->request->getSession()));
     $this->setTplVar('step', 'login');
     $this->setTplVar('last_username', $this->session->get(SecurityContext::LAST_USERNAME));
     $this->setTplVar('error', $error);
     $this->setTplVar('authTwit', $twitter->getAuthorizationUrl($this->generateUrl('facebook_login', array('oauthType' => 'twitter'), TRUE)));
     $this->setTplVar('authFb', $fb->getAuthorizationUrl($this->generateUrl('facebook_login', array('oauthType' => 'fb'), TRUE)));
     //$this->setTplVar('authYahoo', $yahoo->getAuthorizationUrl($redirectUrl . 'yahoo'));
     $this->setTplVar('authYahoo', 'rodo/change_this');
     return $this->renderAjax('Security:login_form');
 }
 /**
  * {@inheritdoc}
  */
 protected function configureOptions(OptionsResolverInterface $resolver)
 {
     parent::configureOptions($resolver);
     $resolver->setDefaults(array('authorization_url' => 'https://api.twitter.com/oauth/authenticate', 'request_token_url' => 'https://api.twitter.com/oauth/request_token', 'access_token_url' => 'https://api.twitter.com/oauth/access_token', 'user_response_class' => '\\Crevillo\\EzSocialLoginBundle\\OAuth\\Response\\TwitterUserResponse', 'infos_url' => 'https://api.twitter.com/1.1/account/verify_credentials.json', 'include_email' => false));
     // Symfony <2.6 BC
     if (method_exists($resolver, 'setDefined')) {
         $resolver->setDefined('x_auth_access_type');
         // @link https://dev.twitter.com/oauth/reference/post/oauth/request_token
         $resolver->setAllowedValues('x_auth_access_type', array('read', 'write'));
         // @link https://dev.twitter.com/rest/reference/get/account/verify_credentials
         $resolver->setAllowedTypes('include_email', 'bool');
     } else {
         $resolver->setOptional(array('x_auth_access_type'));
         $resolver->setAllowedValues(array('x_auth_access_type' => array('read', 'write'), 'include_email' => array(true, false)));
     }
 }