function testOauthAuthenticate() { $result = $this->TestSource->oauth_authenticate('dummy_token'); $this->assertEqual('http://api.twitter.com/oauth/authenticate?oauth_token=dummy_token', $result); $token = $this->TestSource->oauth_request_token(Router::url('/twitter_kit/callback', true)); $result = $this->TestSource->oauth_authenticate(); $this->assertEqual('http://api.twitter.com/oauth/authenticate?oauth_token=' . $token['oauth_token'], $result); }
/** * 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; }
/** * make OAuth Authenticate URL * * @param AppModel $model * @param string $callback_url * @return string authorize_url */ public function twitterAuthenticateUrl($model, $callback_url = null) { $token = $this->DataSource->oauth_request_token($callback_url); return $this->DataSource->oauth_authenticate(); }