Hi Guys,
I`m trying to implement oAuth into my website and i`m 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?ur...r-Service.html
This is the client side implementation,
PHP Code:
$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,
PHP Code:
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,
PHP Code:
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.
PHP Code:
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 what`s i`m doing wrong? But If i print the $_Get array i will get the correct data such as,
PHP Code:
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
Hi Guys,
I`m trying to implement oAuth into my website and i`m 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?ur...r-Service.html
This is the client side implementation,
PHP Code:
$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,
PHP Code:
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,
PHP Code:
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.
PHP Code:
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 what`s i`m doing wrong? But If i print the $_Get array i will get the correct data such as,
PHP Code:
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
|
|
Search Webmaster Help and Solution
oAuth provider Implementation - consumer key is empty??Related ItemsQuery failed: connection to localhost:3354 failed (errno=111, msg=Connection refused). |
