Exemplo n.º 1
0
 /**
  * Verify and fetch token
  *
  * Retrieve the temporary credentials from step 2. Third and final part to
  * OAuth 1.0 authentication is to retrieve token credentials (formally
  * known as access tokens in earlier OAuth 1.0 specs). Now, we'll store
  * the token credentials and discard the temporary ones - they're
  * irrelevant at this stage.
  *
  * @param  string               $oauthToken
  * @param  string               $oauthVerifier
  * @param  TemporaryCredentials $temporaryCredentials
  *
  * @return \League\OAuth1\Client\Credentials\CredentialsInterface
  */
 public function getToken($oauthToken, $oauthVerifier, TemporaryCredentials $temporaryCredentials = null)
 {
     if (is_null($temporaryCredentials)) {
         $sessionKey = self::getCredentialSessionKey();
         $temporaryCredentials = unserialize($_SESSION[$sessionKey]);
         unset($_SESSION[$sessionKey]);
         session_write_close();
     }
     return $this->client->getTokenCredentials($temporaryCredentials, $oauthToken, $oauthVerifier);
 }
Exemplo n.º 2
0
 /**
  * @expectedException InvalidArgumentException
  */
 public function testGettingTokenCredentialsFailsWithManInTheMiddle()
 {
     $server = new Trello($this->getMockClientCredentials());
     $credentials = m::mock('League\\OAuth1\\Client\\Credentials\\TemporaryCredentials');
     $credentials->shouldReceive('getIdentifier')->andReturn('foo');
     $server->getTokenCredentials($credentials, 'bar', 'verifier');
 }