コード例 #1
0
ファイル: twitter.php プロジェクト: elstc/twitter_kit
 /**
  * get OAuth Access Token
  *
  * @param AppModel $model
  * @param string   $oauth_token
  * @param string   $oauth_verifier
  * @return array|false
  */
 public function twitterAccessToken($model, $oauth_token = null, $oauth_verifier = null)
 {
     if (empty($oauth_token) || empty($oauth_verifier)) {
         return false;
     }
     $token = $this->DataSource->oauth_access_token($oauth_token, $oauth_verifier);
     return $token;
 }
コード例 #2
0
ファイル: twitter.php プロジェクト: hiromi2424/twitter_kit
 /**
  * get OAuth Access Token
  *
  * @return array|false
  */
 public function getAccessToken()
 {
     // remove authorize/authenticate url cookie
     $this->deleteAuthorizeCookie();
     if (empty($this->controller->params['url']['oauth_token']) || empty($this->controller->params['url']['oauth_verifier'])) {
         return false;
     }
     $oauth_token = $this->controller->params['url']['oauth_token'];
     $oauth_verifier = $this->controller->params['url']['oauth_verifier'];
     $token = $this->DataSource->oauth_access_token($oauth_token, $oauth_verifier);
     return $token;
 }
コード例 #3
0
 function testOauthAccessToken()
 {
     return $this->skipIf(true);
     $requestToken = $this->TestSource->oauth_request_token(Router::url('/openlist/twitter_kit/callback', true));
     $authUrl = $this->TestSource->oauth_authorize();
     debug($authUrl);
     $url = 'http://localhost/openlist/twitter_kit/callback?oauth_token=ly4DCCcq4gddZMuFNp7vbJgQiSna7Hoq4Xd7CuGOOk&oauth_verifier=Nvnw5OnMkVFv5S4tjLvKLLmsMbDyKEM92HeEILC6u7g';
     $oauth_token = 'ly4DCCcq4gddZMuFNp7vbJgQiSna7Hoq4Xd7CuGOOk';
     $oauth_verifier = 'Nvnw5OnMkVFv5S4tjLvKLLmsMbDyKEM92HeEILC6u7g';
     $token = $this->TestSource->oauth_access_token($oauth_token, $oauth_verifier);
     if (is_string($token)) {
         $this->assertEqual('Invalid / expired Token', $token);
     } else {
         $this->assertTrue(is_array($token));
         $this->assertTrue(is_string($token['oauth_token']));
         $this->assertTrue(is_string($token['oauth_token_secret']));
         $this->assertTrue(is_string($token['user_id']));
         $this->assertTrue(is_string($token['screen_name']));
         $this->assertEqual($token['oauth_token'], $this->TestSource->oauth_token);
         $this->assertEqual($token['oauth_token_secret'], $this->TestSource->oauth_token_secret);
     }
 }