Hey I am using the below code for making a request for
authorization.The alert shows null value.When I am trying to navigate
the url directly it was returning failed value.But through this method
null value is returned back.
function makeSignedRequest() {
var params = {};
params[gadgets.io.RequestParameters.AUTHORIZATION] =
gadgets.io.AuthorizationType.SIGNED;
params[gadgets.io.RequestParameters.CONTENT_TYPE] =
gadgets.io.ContentType.JSON;
var url = "http://mydomain/index.php/MakeSignedRequest";
gadgets.io.makeRequest(url, response, params);
};
function response(ret) {
alert("response>>>"+ret.oauthErrorText);
alert("auth>>>>"+ret.data.auth);
if(ret.data.validated == "OK"){
alert("OK");
return 1;
} else {
alert("failed");
return 0;
}
};
on the server side the code is
<?php
require_once("OAuth.php");
require_once("cert_file_accessor.php");
$payload = array();
$cert_accessor = new CertFileAccessor('mydomain/subdomain/certs',
'orkut');
$cert = $cert_accessor-
>getPublicKey($_REQUEST['xoauth_signature_publickey']);
if ($cert != null) {
//Custom OAuthSignatureMethod class that will return our
public cert
class KeystoreRSASignatureMethod extends
OAuthSignatureMethod_RSA_SHA1 {
public function __construct($cert) {
$this->_cert = $cert;
}
protected function fetch_public_cert(&$request) {
return $this->_cert;
}
}
//Build a request object from the current request
$request = OAuthRequest::from_request(null, null,
array_merge($_GET, $_POST));
//Initialize the new signature method
$signature_method = new KeystoreRSASignatureMethod($cert);
//Check the request signature
$auth_ok = $signature_method->check_signature($request, null,
null, $_GET["oauth_signature"]);
} else {
$payload['cert'] = 'missing';
}
if ($auth_ok == 1) {
$payload["auth"] = "OK";
/* do your thing */
} else {
$payload["auth"] = "Failed";
}
echo json_encode($payload);
Please help me to solve the problem.I am trying different ways since
last 10 days.Finally I posted here to get some solution.Please provide
me a solution.
Thank u in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Orkut Developer Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/opensocial-orkut?hl=en
-~----------~----~----~----~------~----~------~--~---