Ejemplo n.º 1
0
 function startLogin()
 {
     $parameters = array("scope" => $this->scope, "access_type" => "offline");
     $optionals = array("scope", "access_type", "redirect_uri", "approval_prompt", "hd");
     foreach ($optionals as $parameter) {
         if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) {
             $parameters[$parameter] = $this->config[$parameter];
         }
     }
     Social_Auth::redirect($this->api->authorizeUrl($parameters));
 }
Ejemplo n.º 2
0
 function startLogin()
 {
     $parameters = array("scope" => $this->scope, "redirect_uri" => $this->client, "display" => "popup");
     $optionals = array("scope", "redirect_uri", "display");
     foreach ($optionals as $parameter) {
         if (isset($this->config[$parameter]) && !empty($this->config[$parameter])) {
             $parameters[$parameter] = $this->config[$parameter];
         }
     }
     $url = $this->api->getLoginUrl($parameters);
     Social_Auth::redirect($url);
 }
Ejemplo n.º 3
0
 function startLogin()
 {
     $tokens = $this->api->requestToken($this->client);
     $this->request_tokens_raw = $tokens;
     if ($this->api->http_code != 200) {
         throw new Social_Exception("Auth failed! {$this->network_name} error: " . $this->errorMessageByStatus($this->api->http_code));
     }
     if (!isset($tokens["oauth_token"])) {
         throw new Social_Exception("Auth failed! {$this->network_name}: invalid oauth token.");
     }
     $this->setToken("request_token", $tokens["oauth_token"]);
     $this->setToken("request_token_secret", $tokens["oauth_token_secret"]);
     Social_Auth::redirect($this->api->authorizeUrl($tokens));
 }
Ejemplo n.º 4
0
 function login()
 {
     Social_Logger::info("###Social_Adapter::login( {$this->network_name} ) ");
     if (!$this->adapter) {
         throw new Social_Exception("Social_Adapter::login() cannot be used directly");
     }
     foreach (Social_Auth::$config["networks"] as $network => $params) {
         Social_Auth::session()->deleteByKey("sa_session.{$network}.sa_callback");
         Social_Auth::session()->deleteByKey("sa_session.{$network}.sa_client");
         Social_Auth::session()->deleteByKey("sa_session.{$network}.network_params");
     }
     $this->logout();
     $social_auth_base_url = Social_Auth::$config["base_url"];
     $this->params["sa_token"] = session_id();
     $this->params["sa_time"] = time();
     $this->params["sa_login"] = $social_auth_base_url . (strpos($social_auth_base_url, '?') ? '&' : '?') . "sa_login={$this->network_name}&sa_time={$this->params["sa_time"]}";
     $this->params["sa_login_finish"] = $social_auth_base_url . (strpos($social_auth_base_url, '?') ? '&' : '?') . "sa_login_finish={$this->network_name}";
     Social_Auth::session()->set("sa_session.{$this->network_name}.sa_callback", $this->params["sa_callback_url"]);
     Social_Auth::session()->set("sa_session.{$this->network_name}.sa_client", $this->params["sa_login_finish"]);
     Social_Auth::session()->set("sa_session.{$this->network_name}.network_params", $this->params);
     Social_Auth::session()->set("sa_config", Social_Auth::$config);
     Social_Logger::debug("Social_Adapter::login( {$this->network_name} ), redirecting sa_login url.");
     Social_Auth::redirect($this->params["sa_login"]);
 }
Ejemplo n.º 5
0
 function startLogin()
 {
     Social_Auth::redirect($this->api->authorizeUrl(array("scope" => $this->scope)));
 }