Skip to content

Instantly share code, notes, and snippets.

@amcjen
Created May 2, 2012 18:37
Show Gist options
  • Save amcjen/2579062 to your computer and use it in GitHub Desktop.
Save amcjen/2579062 to your computer and use it in GitHub Desktop.
var singly = require('./singly');
singly.getProtectedResource('/services/twitter/timeline', user, function(err, response) {
console.log(response); // this will be the JSON response from Singly for given user
});
var OAuth2 = require('oauth').OAuth2;
var config = require('../lib/config').config,
db = require('../lib/schema'),
logger = require('../lib/logger').logger;
var oa = new OAuth2(config.singlyClientId,
config.singlyClientSecret,
config.singlyOauthBaseUrl);
exports.getOAuthAccessToken = function(code, options, callback) {
oa.getOAuthAccessToken(code, {}, callback);
};
exports.getProtectedResource = function(path, user, callback) {
oa.getProtectedResource(config.singlyOauthBaseUrl + path, user.singlyAccessToken, callback);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment