Hi. I ran this code (after setting up cert_file_accessor.php and
downloading the certificate to disk) and I receive the following
payload, which indicates the request is validated:

{\"auth\":\"OK\"}

ret.oauthErrorText is returning undefined (presumably because there is
no error...). Since there is no 'validated' key in the returned
object, your response function is alerting 'Failed' but I believe the
request is validated correctly on the server.

Can you provide the full response returned from the makeRequest call?
If you have Firebug installed, you should see the request issued under
the Console tab, which you can expand to see the server response. It
should start with "throw 1; < don't be evil' >" unless there's an
error.

I assume you have already set up cert_file_accessor.php and copied to
the certificate to disk?

- Jason

On Oct 27, 5:36 am, laden <[EMAIL PROTECTED]> wrote:
> 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 opensocial-orkut@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to