Client OAuth 1.0a Request Authorization for Node
Example
API
create(options)
- creates instance, create unique instance(supports Singletone)public
- public keysecret
- secret key
fetch(request object, callback)
-
request object
- must have- URL - URL to request -
mandatory
- Method - Method to use, GET/POST -
mandatory
- body - data when using POST method -
optonal
- json -
true/false
-optional
- true when passing objet
- false when passing string
- URL - URL to request -
-
callback
- The callback argument gets 2 arguments:- An error when applicable (usually from http.ClientRequest object)
- An http.IncomingMessage object
-
Example
var oauthClient = require("oauthclient").create({
public: "asdfg2345tghj89uk9klas34d5f6g7uhj9kl",
secret: "s3d4f56g7h8jk09j8h7g6fcvb7n8m90"
};
var requestObj = {
"method": "GET",
"url": "https:///www.domain.taht.spports.oauth1.0"
};
oauthClientInstance.fetch(requestObj, function (err, data) {
/// do somthing with err or data
});