Fork me on GitHub Fork me on GitHub

OAuthProvider


<%

var oauth = require("oauth");
var provider = {
	"oauth_version" : "1",
	"authorization_url" : "https://www.linkedin.com/uas/oauth/authorize",
	"access_token_url" : "https://api.linkedin.com/uas/oauth/accessToken",
	"request_token_url" : "https://api.linkedin.com/uas/oauth/requestToken",
	"api_key" : "API_KEY",
	"api_secret" : "SECRET"
}
var linkedin = new oauth.OAuthProvider(provider);
print(linkedin.getAuthorizationUrl()); 

%>

<%

var accessToken = linkedin.getAccessToken("3741501");
var response = linkedin.sendOAuthRequest(accessToken, "GET", "http://api.linkedin.com/v1/groups/59053/posts?count=20&start=1&format=json");
print(response.getBody()); 

%>

Overview

OAuthProvider api act as an oauth client for accessing resources protected by OAuth


Operations

Member Returns Description
OAuthProvider(provider)OAuthProvider Object

Returns the OAuthProvider Object

var oauth = require("oauth");
var provider = {
		"oauth_version": "1",
		"authorization_url": "https://www.linkedin.com/uas/oauth/authorize",
		"access_token_url": "https://api.linkedin.com/uas/oauth/accessToken",
		"request_token_url": "https://api.linkedin.com/uas/oauth/requestToken",
		"api_key": "API_KEY",
		"api_secret": "SECRET"
}
var linkedin = new oauth.OAuthProvider(provider);
getAuthorizationUrl()StringReturns the authorization url to obtain the authentication code

getAccessToken(authCode)Objectreturns a token object

var accessToken = linkedin.getAccessToken("3741501");
sendOAuthRequest(accessToken, verb, url[,parameters])Objectreturns a oauth response object.

var response = linkedin.sendOAuthRequest(accessToken, "GET", "http://api.linkedin.com/v1/groups/59053/posts?count=20&start=1&format=json");
response.getBody()Stringreturns the response body.

print(response.getBody());