/** * Method to validate that the stored token is indeed authenticated. * * @param $request_token * @return array|WP_Error */ function check_access_token($request_token) { $signed_parameters = $this->sign_call('https://api.500px.com/v1/users', 'GET', array()); // $end_point = $this->end_point(); $end_point = 'https://api.500px.com/v1/users?' . Photonic_Processor::build_query($signed_parameters); $response = Photonic::http($end_point, 'GET', null); return $response; }
/** * Tests to see if the OAuth Access Token that is cached is still valid. This is important because a user might have manually revoked * access for your app through the provider's control panel. * * @param $request_token * @return array|WP_Error */ function check_access_token($request_token) { if ($this->provider == 'flickr') { $method = 'GET'; } else { $method = 'POST'; } $signature = $this->generate_signature($this->check_access_token_method(), array('method' => $this->check_access_token_method()), $method, $request_token); $parameters = array('oauth_consumer_key' => $this->api_key, 'oauth_nonce' => $this->nonce, 'oauth_signature' => $signature, 'oauth_signature_method' => $this->oauth_signature_method(), 'oauth_timestamp' => $this->oauth_timestamp, 'oauth_token' => $request_token['oauth_token'], 'oauth_version' => $this->oauth_version, 'method' => $this->check_access_token_method()); $end_point = $this->end_point(); if ($method == 'GET') { $end_point .= '?' . Photonic_Processor::build_query($parameters); $parameters = null; } $response = Photonic::http($end_point, $method, $parameters); return $response; }
/** * Method to validate that the stored token is indeed authenticated. * * @param $request_token * @return array|WP_Error */ function check_access_token($request_token) { $parameters = array('method' => $this->check_access_token_method(), 'format' => 'json', 'nojsoncallback' => 1); $signed_parameters = $this->sign_call($this->end_point(), 'GET', $parameters); $end_point = $this->end_point(); $end_point .= '?' . Photonic_Processor::build_query($signed_parameters); $parameters = null; $response = Photonic::http($end_point, 'GET', $parameters); return $response; }