Comparing version 0.2.1 to 0.3.0
34
lib.js
@@ -10,3 +10,13 @@ var request = require('request'); | ||
client.getAuthorizeURL = function(service, options) { | ||
/* | ||
IMPORTANT: getAuthenticateURL replaces getAuthorizeURL | ||
see https://singly.com/docs/authorization | ||
Params: | ||
service: (required) the service to auth | ||
options: a hash of any further options to pass (i.e. scope) | ||
**access_token MUST be passed if you wish to connect an additional profile | ||
instead of creating a new account | ||
*/ | ||
client.getAuthenticateURL = function(service, options) { | ||
if (!options) options = {}; | ||
@@ -16,6 +26,10 @@ if (!options.client_id) options.client_id = clientId; | ||
options.service = service; | ||
var cbURL = options.callbackURL || redirectURI; | ||
return apiBaseUrl + '/oauth/authorize?' + querystring.stringify(options); | ||
} | ||
return apiBaseUrl + '/oauth/authenticate?' + querystring.stringify(options); | ||
}; | ||
client.getAuthorizeURL = function() { | ||
throw "Singly module: getAuthenticateURL replaces" + | ||
"getAuthorizeURL in Singly module"; | ||
}; | ||
client.getAccessToken = function(code, callback) { | ||
@@ -43,3 +57,3 @@ var data = { | ||
}); | ||
} | ||
}; | ||
@@ -49,3 +63,3 @@ // build a consistent and clean URI | ||
var uri = apiBaseUrl; | ||
if (path.indexOf(/\/?v[0-9]/) !== 0) uri += '/v' + API_VERSION | ||
if (path.indexOf(/\/?v[0-9]/) !== 0) uri += '/v' + API_VERSION; | ||
if (path.indexOf('/') !== 0) uri += '/'; | ||
@@ -66,3 +80,3 @@ return uri + path; | ||
request.post({uri:uri, json:options.body, qs:options.qs}, callback); | ||
} | ||
}; | ||
@@ -73,3 +87,3 @@ client.get = function(path, options, callback) { | ||
request.get({uri:uri, json:true, qs:options.qs}, callback); | ||
} | ||
}; | ||
@@ -83,5 +97,5 @@ client.apiCall = function(path, params, callback) { | ||
}); | ||
} | ||
}; | ||
return client; | ||
} | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"description": "Client library for the Singly API", | ||
"version": "0.2.1", | ||
"version": "0.3.0", | ||
"homepage": "https://singly.com", | ||
@@ -8,0 +8,0 @@ "main" : "lib.js", |
singly-js | ||
========= | ||
Singly API client library in Node | ||
Singly API client library in Node | ||
# Version History | ||
## 0.3.0 (11/30/12) | ||
- Deprecate getAuthorizeURL and add getAuthenticateURL | ||
see https://singly.com/docs/authorization | ||
Params: | ||
service: (required) the service to auth | ||
options: a hash of any further options to pass (i.e. scope) | ||
**access_token MUST be passed if you wish to connect an additional profile | ||
instead of creating a new account |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
5486
124
17
1