示例#1
0
 /**
  * make OAuth Authenticate URL
  *
  * @param string $callback_url
  * @param bool   $use_cookie
  * @return string authorize_url
  */
 public function getAuthenticateUrl($callback_url = null, $use_cookie = false)
 {
     // -- check Cookie
     $cookie_key = $this->_getAuthenticateUrlCookieName();
     if ($use_cookie && $this->Cookie->read($cookie_key)) {
         return $this->Cookie->read($cookie_key);
     }
     // -- request token
     $token = $this->DataSource->oauth_request_token($callback_url);
     $url = $this->DataSource->oauth_authenticate();
     // -- set cookie
     if ($use_cookie) {
         $this->Cookie->write($cookie_key, $url, true, self::OAUTH_URL_COOKIE_EXPIRE);
     }
     return $url;
 }