Grab an access token from the pocket API, after sending it
the consumer key and request token from earlier

@param  string $consumer_key
@param  string $request_token
436683
public function receiveToken($consumer_key, $request_token)
    {
        $pocketData = $this->convertRequestToken($consumer_key, $request_token);

        $access_token = $pocketData->access_token;

        return $access_token;
    }
888342
private function checkSignature($request, $consumer, $token)
    {
        // this should probably be in a different method
        $timestamp = @$request->getParameter('oauth_timestamp');
        $nonce = @$request->getParameter('oauth_nonce');

        $this->checkTimestamp($timestamp);
        $this->checkNonce($consumer, $token, $nonce, $timestamp);

        $signatureMethod = $this->getSignatureMethod($request);

        $signature = $request->getParameter('oauth_signature');
        $valid_sig = $signatureMethod->checkSignature(
            $request,
            $consumer,
            $token,
            $signature
        );

        if (!$valid_sig) {
            throw new Exception("Invalid signature");
        }
    }
982484
public function countServerTokens ( $consumer_key )
	{
		
                //
                $count =0;
                $sql = "BEGIN SP_COUNT_SERVICE_TOKENS(:P_CONSUMER_KEY, :P_COUNT, :P_RESULT); END;";

                // parse sql
                $stmt = oci_parse($this->conn, $sql) or die ('Can not parse query');

                // Bind In and Out Variables
                oci_bind_by_name($stmt, ':P_CONSUMER_KEY', $consumer_key, 255);
                oci_bind_by_name($stmt, ':P_COUNT', $count, 40);
                oci_bind_by_name($stmt, ':P_RESULT', $result, 20);
                
                //Execute the statement
                oci_execute($stmt);                
                //
		return $count;
	}
395333
public User getcurrentUser(String consumerKey, String consumerSecret,
			String accessToken, String accessTokenSecret)
			throws ConnectionException {
		httpClient = new PlatformHttpClient(consumerKey, consumerSecret,
				accessToken, accessTokenSecret);
		User user = null;;
		try {
			user = this.httpClient.getCurrentUser();
		} catch (Exception e) {
			e.printStackTrace();
		}
		return user;
	}
65264
Key getSharedSecretKey(JwtConsumerConfig config) throws KeyException {
		if (config == null) {
			if (tc.isDebugEnabled()) {
				Tr.debug(tc, "JWT consumer config object is null");
			}
			return null;
		}
		String sharedKey = config.getSharedKey();
		return createKeyFromSharedKey(sharedKey);
	}
125280
def get_access_token
      @client = TwitterOAuth::Client.new(:consumer_key => ConsumerKey, :consumer_secret => ConsumerSecret)
      request_token = @client.request_token
      # ask the user to visit the auth url
      puts "To authenticate your client, visit the URL: #{request_token.authorize_url}"
      open_link request_token.authorize_url
      # wait for the user to give us the PIN back
      print 'Enter PIN: '
      begin
        @client.authorize(request_token.token, request_token.secret, :oauth_verifier => self.class.get_input.chomp)
      rescue OAuth::Unauthorized
        false # Didn't get an access token
      end
    end
1314119
private function get_token(&$request, $consumer, $token_type="access") {
    $token_field = @$request->get_parameter('oauth_token');
    if ( !$token_field) return false;
    $token = $this->data_store->lookup_token(
      $consumer, $token_type, $token_field
    );
    if (!$token) {
      throw new OAuthException("Invalid $token_type token: $token_field");
    }
    return $token;
  }
24439
public function deleteConsumer ( $consumer_key, $user_id, $user_is_admin = false )
    {
        if ($user_is_admin)
        {
            $this->query('
                    DELETE FROM oauth_server_registry
                    WHERE osr_consumer_key = \'%s\'
                      AND (osr_usa_id_ref = \'%d\' OR osr_usa_id_ref IS NULL)
                    ', $consumer_key, $user_id);
        }
        else
        {
            $this->query('
                    DELETE FROM oauth_server_registry
                    WHERE osr_consumer_key = \'%s\'
                      AND osr_usa_id_ref   = \'%d\'
                    ', $consumer_key, $user_id);
        }
    }
819617
public function getRequestToken($callback_uri = NULL) {

    // set callback_uri
    $this->getOauthPlugin()->setCallbackUri($callback_uri);

    //Get request token
    $response = $this->get($this->getConfig('request_token_path'))->send();
    $request_token = array();
    parse_str($response->getBody(), $request_token);

    // Throw exception if the callback isn't confirmed
    if (!isset($request_token['oauth_callback_confirmed']) || !in_array($request_token['oauth_callback_confirmed'], array(true, "true"))) {
      throw new \Exception("There was an error regarding the callback confirmation");
    }

    // Return RequestToken
    return $request_token;
  }
678105
public function findOauthConsumerResource($consumer_key)
	{
		$returnValue = null;

		$class = $this->getClass(self::CLASS_URI_OAUTH_CONSUMER);
		$instances = $class->searchInstances(array(self::PROPERTY_OAUTH_KEY => $consumer_key), array('like' => false, 'recursive' => true));
		if (count($instances) == 0) {
			throw new \tao_models_classes_oauth_Exception('No Credentials for consumer key '.$consumer_key);
		}
		if (count($instances) > 1) {
			throw new \tao_models_classes_oauth_Exception('Multiple Credentials for consumer key '.$consumer_key);
		}
		$returnValue	= current($instances);

		return $returnValue;
	}
907922
public static function fromConsumerAndToken($consumer, $token, $http_method, $http_url, $parameters = null)
    {
        $parameters = ($parameters) ?  $parameters : [];
        $defaults = ["oauth_version" => Request::$version,
                          "oauth_nonce" => Request::generateNonce(),
                          "oauth_timestamp" => Request::generateTimestamp(),
                          "oauth_consumer_key" => $consumer->key];
        if ($token) {
            $defaults['oauth_token'] = $token->key;
        }

        $parameters = array_merge($defaults, $parameters);

        return new Request($http_method, $http_url, $parameters);
    }
820166
public function oAuth($consumerKey, $consumerSecret, $oauthToken = null, $oauthTokenSecret = null)
    {
        $this->auth = new OAuth($consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret);
        return $this->auth;
    }
738239
def auth(self, request):
        
        callback_url = self.callback_url(request)

        request_token = Pocket.get_request_token(consumer_key=self.consumer_key, redirect_uri=callback_url)
        # Save the request token information for later
        request.session['request_token'] = request_token
        # URL to redirect user to, to authorize your app
        auth_url = Pocket.get_auth_url(code=request_token, redirect_uri=callback_url)

        return auth_url
1180257
function (consumer_key, consumer_secret) {
        this.oauth = new OAuth.OAuth(
          'https://query.yahooapis.com/v1/yql/',
          'https://query.yahooapis.com/v1/yql/',
          consumer_key, //consumer key
          consumer_secret, //consumer secret
          '1.0',
          null,
          'HMAC-SHA1'
          );
        this.oauth.setClientOptions({ requestTokenHttpMethod: 'POST' });

        return this;
    }
1051192
public function init($consumerKey, $consumerSecret, $oauthToken, $oauthTokenSecret, $bearerToken)
    {
        $this->twitter->setConsumerKey($consumerKey, $consumerSecret);

        if (! is_null($bearerToken)) {
            $this->setBearerToken($bearerToken);
        } elseif (! is_null($oauthToken) && ! is_null($oauthTokenSecret)) {
            $this->setToken($oauthToken, $oauthTokenSecret);
        } elseif ($this->hasSessionToken()) {
            $this->setSessionToken();
        }
    }
213336
public function addConsumerRequestToken ( $consumer_key, $options = array() )
	{
		$token  = $this->generateKey(true);
		$secret = $this->generateKey();
		$osr_id	= $this->query_one('
						SELECT osr_id
						FROM oauth_server_registry
						WHERE osr_consumer_key = \'%s\'
						  AND osr_enabled      = 1
						', $consumer_key);

		if (!$osr_id)
		{
			throw new OAuthException2('No server with consumer_key "'.$consumer_key.'" or consumer_key is disabled');
		}

		if (isset($options['token_ttl']) && is_numeric($options['token_ttl']))
		{
			$ttl = intval($options['token_ttl']);
		}
		else
		{
			$ttl = $this->max_request_token_ttl;
		}

		if (!isset($options['oauth_callback'])) {
	 		// 1.0a Compatibility : store callback url associated with request token
			$options['oauth_callback']='oob';
 		}
		
		$this->query('
				INSERT INTO oauth_server_token
				SET ost_osr_id_ref		= %d,
					ost_usa_id_ref		= 1,
					ost_token			= \'%s\',
					ost_token_secret	= \'%s\',
					ost_token_type		= \'request\',
					ost_token_ttl       = DATE_ADD(NOW(), INTERVAL %d SECOND),
					ost_callback_url    = \'%s\'
				ON DUPLICATE KEY UPDATE
					ost_osr_id_ref		= VALUES(ost_osr_id_ref),
					ost_usa_id_ref		= VALUES(ost_usa_id_ref),
					ost_token			= VALUES(ost_token),
					ost_token_secret	= VALUES(ost_token_secret),
					ost_token_type		= VALUES(ost_token_type),
					ost_token_ttl       = VALUES(ost_token_ttl),
					ost_callback_url    = VALUES(ost_callback_url),
					ost_timestamp		= NOW()
				', $osr_id, $token, $secret, $ttl, $options['oauth_callback']);
		
		return array('token'=>$token, 'token_secret'=>$secret, 'token_ttl'=>$ttl);
	}
789558
protected function getToken(&$request, $consumer, $token_type = "access")
    {
        $token_field = @$request->getParameter('oauth_token');
        $token = $this->data_store->lookupToken(
            $consumer, $token_type, $token_field
        );
        if (!$token) {
            throw new OAuthException("Invalid $token_type token: $token_field");
        }
        
        return $token;
    }