/**
  * begin login step 
  */
 function loginBegin()
 {
     // app credentials
     if (!$this->getApplicationId() || !$this->getApplicationSecret()) {
         throw new Exception('Application credentials are missing. Check your hybridauth configuration file. ' . 'For more information refer to http://hybridauth.sourceforge.net/userguide/Configuration.html', Exception::MISSING_APPLICATION_CREDENTIALS, $this);
     }
     $parameters = $this->getEndpointAuthorizeUriAdditionalParameters();
     $url = $this->generateAuthorizeUri($parameters);
     Util::redirect($url);
 }
 /**
  * begin login step 
  */
 function loginBegin()
 {
     if (empty($this->openidIdentifier)) {
         throw new Exception("Missing 'openid_identifier'. " . 'For more information refer to http://hybridauth.sourceforge.net/userguide/IDProvider_info_OpenID.html', Exception::PROVIDER_NOT_PROPERLY_CONFIGURED, $this);
     }
     $this->api->identity = $this->openidIdentifier;
     $this->api->returnUrl = $this->hybridauthEndpoint;
     $this->api->required = array('namePerson/first', 'namePerson/last', 'namePerson/friendly', 'namePerson', 'contact/email', 'birthDate', 'birthDate/birthDay', 'birthDate/birthMonth', 'birthDate/birthYear', 'person/gender', 'pref/language', 'contact/postalCode/home', 'contact/city/home', 'contact/country/home', 'media/image/default');
     # redirect the user to the provider authentication url
     Util::redirect($this->api->authUrl());
 }
 /**
  * ...
  */
 function authenticate($parameters = array())
 {
     if ($this->isAuthorized()) {
         return $this;
     }
     foreach ($this->getHybridauthConfig('providers') as $idpid => $params) {
         $this->storage->delete("{$idpid}.hauth_return_to");
         $this->storage->delete("{$idpid}.hauth_endpoint");
         $this->storage->delete("{$idpid}.id_provider_params");
     }
     $this->storage->deleteMatch("{$this->providerId}.");
     $base_url = $this->getHybridauthConfig('base_url');
     $defaults = array('hauth_return_to' => Util::getCurrentUrl(), 'hauth_endpoint' => $base_url . (strpos($base_url, '?') ? '&' : '?') . "hauth.done={$this->providerId}", 'hauth_start_url' => $base_url . (strpos($base_url, '?') ? '&' : '?') . "hauth.start={$this->providerId}&hauth.time=" . time());
     $parameters = array_merge($defaults, (array) $parameters);
     $this->storage->set($this->providerId . ".hauth_return_to", $parameters["hauth_return_to"]);
     $this->storage->set($this->providerId . ".hauth_endpoint", $parameters["hauth_endpoint"]);
     $this->storage->set($this->providerId . ".id_provider_params", $parameters);
     // store config
     $this->storage->config("CONFIG", $this->getHybridauthConfig());
     // redirect user to start url
     Util::redirect($parameters["hauth_start_url"]);
 }
Example #4
0
 /**
  * redirect the user to hauth_return_to (the callback url)
  */
 private function _returnToCallbackUrl($providerId)
 {
     $callback_url = $this->storage->get("{$providerId}.hauth_return_to");
     $this->storage->delete("{$providerId}.hauth_return_to");
     $this->storage->delete("{$providerId}.hauth_endpoint");
     $this->storage->delete("{$providerId}.id_provider_params");
     Util::redirect($callback_url);
 }