Hi Guys,
Im trying to implement oAuth into my website and im in the process of implementing the server. Im using symfony framework for the implementation but i dont think that is important but just mention to give the whole overview of the system 🙂
I have found a great article by rasmus. Here is the link if anyone interested,
http://toys.lerdorf.com/index.php?url=archives/55-Writing-an-OAuth-Provider-Service.html
This is the client side implementation,
$oauth = new OAuth("VQ7ggfnVyoIpXfRtiwqKw","1vstRt929PiJyJLp8BDjQDYAwAjhYx4IVGCGxLuzKk",OAUTH_SIG_METHOD_HMACSHA1,OAUTH_AUTH_TYPE_URI); //initiate
$oauth->enableDebug();
try {
$request_token_info = $oauth->getRequestToken("http://nas.site/oauth/request_token"); //get request token
print_r($request_token_info);
}
catch(Exception $e)
{
print $e;
}
On the server side I have a task called request_token which looks like this,
public function executeRequest_token(sfWebRequest $request)
{
try {
$this->provider = new OAuthProvider();
$this->provider->consumerHandler(array($this,'lookupConsumer'));
$this->provider->callconsumerHandler();
}
catch (OAuthException $E) {
echo OAuthProvider::reportProblem($E);
}
}
and the callback function,
public function lookupConsumer($provider)
{
print_r($provider);
die();
}
But this just print an empty array as below instead of having the values which Im passed from the client application.
Array ( [OAuthProvider_Object ( ____] => Array ( [consumer_key] => > [consumer_secret] => [nonce] => [token] => [timestamp] => [version] => [signature_method] => [callback] => [request_token_endpoint] => ) ) )
Does anyone know the reason for this or whats im doing wrong? But If i print the $Get array i will get the correct data such as,
Array ( [Array ( ____] => Array ( [oauth_consumer_key] => > VQ7ggfnVyoIpXfRtiwqKw [oauth_signature_method] => HMAC-SHA1 [oauth_nonce] => 16789213704c6cfd1d176d38.61646854 [oauth_timestamp] => 1282211101 [oauth_version] => 1.0 [oauth_signature] => Hr9Oux8R7pxRcuLQ2O8cSvg6yr8= ) ) )
Really appreciate all your help.
Thanks,
Best regards,
Niroshan