Verify Access

Resource

oauth.verifyaccess

Description

Verify a signed request.

Request Parameters

Parameter Description
spkey (required) The service provider key assigned by Mashery
url (required)
Signed url

Response

A boolean indicating if url was verified or not.

Example

JSON Request

 

{
      "method": "oauth.verifyaccess", 
      "params": [
            {
                  "spkey": "abcqcgpw3zu2y78y9bs8vs2h", 
                  "properties": {
                        "url": "http://localapi.localproxy.mashery.com/account?oauth_consumer_key=55aadgt8mkh2dghyup9tk5ta&oauth_nonce=aa619b6233004f05ea3b57f9901f94ce023e66d6&oauth_signature=19X03Y6MMzzFaqP4r24wRSvtc2A%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1303498060&oauth_token=T15Mg87us5ulBdDF8lye3QjHR6vMLQNCMcki80b7AYTRvZjWG09dCpcQQc8xS3aqMNNYlrCZ23sP5nN71HsroH9w--&oauth_version=1.0&term=angel"
                  }
            }
      ], 
      "id": 1
}

 

JSON Response

 

{"result": {
    "success": true
    },
"error": null,
"id": 1}

{"result": null,
"error": {
    "name": "JSONRPCError",
    "code": 401,
    "message": "Invalid or Expired Token"
    },
"id": 1}

 

PHP Sample Code

 

<?php

// Acme developer key to access Mashery APIs
$key = 'aa5348dpjpv9rb97dfgj4efv';
$secret = '9TQWExBJ';

// Acme service to make calls upon
$spkey = 'c7xcx8qweryvtr8ws6jqbn6b';

// User to list apps for
$user_token = 'T1MkAIO9uZZz5n31u8jZAAjQ3p_snQP0ppcBgM~TmzJ2Q-';

$sig = hash('md5', $key . $secret . time());
$url = "http://api.mashery.com/services/jsonrpc?apikey={$key}&sig={$sig}&mashery_area=acme";

$call = array(
    'method' => 'oauth.verifyaccess',
	'params' => array(array('spkey' => 'n6xcx8xmenyvtr8ws6jqbn6b', 'properties' => array('url' => 'http://api.acme.com/resource_in_question/72371613?oauth_consumer_key=8jb2u7d5uhjbcbfzz82pcqwc&oauth_nonce=da7abzz5497a8a09b380dfd7308f0fa34eb7337c&oauth_signature=S%sz5mYP%2Fsac47q%2Bi6Ij7i8AtjM%3D&oauth_signature_method=HMAC-SHA1&oauth_timestamp=1303498529&oauth_token=T19CQERQXVNFEf3Bn4f6LMkpNjHqgTFgahuFmUuizo46MumTteEGX2.p23jlpH7_EOr1hc8vgMPiVvOwcSNravgg--&oauth_version=1.0'))),
    'id' => 1,
);

$jcall = json_encode($call);

print $jcall;

echo "\n";

$req = new HttpRequest($url, HttpRequest::METH_POST);

$req->setBody($jcall);
$req->setContentType('application/json');

$msg = $req->send();

print_r($msg);

Docs Navigation