public function accessToken ()
	{
		OAuthRequestLogger::start($this);

		try
		{
			$this->verify('request');

			$options = array();
			$ttl     = $this->getParam('xoauth_token_ttl', false);
			if ($ttl)
			{
				$options['token_ttl'] = $ttl;
			}

			$verifier = $this->getParam('oauth_verifier', false);
 			if ($verifier) {
 				$options['verifier'] = $verifier;
 			}
			
			$store  = OAuthStore::instance();
			$token  = $store->exchangeConsumerRequestForAccessToken($this->getParam('oauth_token', true), $options);
			$result = 'oauth_token='.$this->urlencode($token['token'])
					.'&oauth_token_secret='.$this->urlencode($token['token_secret']);
					
			if (!empty($token['token_ttl']))
			{
				$result .= '&xoauth_token_ttl='.$this->urlencode($token['token_ttl']);
			}
					
			header('HTTP/1.1 200 OK');
			header('Content-Length: '.strlen($result));
			header('Content-Type: application/x-www-form-urlencoded');

			echo $result;
		}
		catch (OAuthException2 $e)
		{
			header('HTTP/1.1 401 Access Denied');
			header('Content-Type: text/plain');

			echo "OAuth Verification Failed: " . $e->getMessage();
		}
		
		OAuthRequestLogger::flush();
		exit();
	}
public function accessToken ()
	{
		OAuthRequestLogger::start($this);

		try
		{
			$this->verify('request');

			$options = array();
			$ttl     = $this->getParam('xoauth_token_ttl', false);
			if ($ttl)
			{
				$options['token_ttl'] = $ttl;
			}

			$verifier = $this->getParam('oauth_verifier', false);
 			if ($verifier) {
 				$options['verifier'] = $verifier;
 			}
			
			$store  = OAuthStore::instance();
			$token  = $store->exchangeConsumerRequestForAccessToken($this->getParam('oauth_token', true), $options);
			$result = 'oauth_token='.$this->urlencode($token['token'])
					.'&oauth_token_secret='.$this->urlencode($token['token_secret']);
					
			if (!empty($token['token_ttl']))
			{
				$result .= '&xoauth_token_ttl='.$this->urlencode($token['token_ttl']);
			}
					
			header('HTTP/1.1 200 OK');
			header('Content-Length: '.strlen($result));
			header('Content-Type: application/x-www-form-urlencoded');

			echo $result;
		}
		catch (OAuthException2 $e)
		{
			header('HTTP/1.1 401 Access Denied');
			header('Content-Type: text/plain');

			echo "OAuth Verification Failed: " . $e->getMessage();
		}
		
		OAuthRequestLogger::flush();
		exit();
	}
public function accessToken ( ) { OAuthRequestLogger :: start ( $ this ) ; try { $ this -> verify ( 'request' ) ; $ options = array ( ) ; $ ttl = $ this -> getParam ( 'xoauth_token_ttl' , false ) ; if ( $ ttl ) { $ options [ 'token_ttl' ] = $ ttl ; } $ verifier = $ this -> getParam ( 'oauth_verifier' , false ) ; if ( $ verifier ) { $ options [ 'verifier' ] = $ verifier ; } $ store = OAuthStore :: instance ( ) ; $ token = $ store -> exchangeConsumerRequestForAccessToken ( $ this -> getParam ( 'oauth_token' , true ) , $ options ) ; $ result = 'oauth_token=' . $ this -> urlencode ( $ token [ 'token' ] ) . '&oauth_token_secret=' . $ this -> urlencode ( $ token [ 'token_secret' ] ) ; if ( ! empty ( $ token [ 'token_ttl' ] ) ) { $ result .= '&xoauth_token_ttl=' . $ this -> urlencode ( $ token [ 'token_ttl' ] ) ; } header ( 'HTTP/1.1 200 OK' ) ; header ( 'Content-Length: ' . strlen ( $ result ) ) ; header ( 'Content-Type: application/x-www-form-urlencoded' ) ; echo $ result ; } catch ( OAuthException2 $ e ) { header ( 'HTTP/1.1 401 Access Denied' ) ; header ( 'Content-Type: text/plain' ) ; echo "OAuth Verification Failed: " . $ e -> getMessage ( ) ; } OAuthRequestLogger :: flush ( ) ; exit ( ) ; }
Exchange a request token for an access token.
The exchange is only succesful iff the request token has been authorized.

Never returns, calls exit() when token is exchanged or when error is returned.
Exchange a request token for an access token . The exchange is only succesful iff the request token has been authorized .