Created
May 2, 2012 18:37
-
-
Save amcjen/2579062 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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