Permalink
Browse files

fetchOAuthUser for facebook module now returns a Promise.

  • Loading branch information...
1 parent f085178 commit 7200352385d0d6ffd700a07edc09f8dee1777d58 @bnoguchi committed Apr 5, 2011
Showing with 4 additions and 1 deletion.
  1. +4 −1 lib/facebook.js
View
@@ -1,4 +1,5 @@
-var oauthModule = require('./oauth');
+var oauthModule = require('./oauth')
+ , Promise = require('./promise');
var fb = module.exports =
oauthModule.submodule('facebook')
@@ -16,9 +17,11 @@ oauthModule.submodule('facebook')
return authUri;
})
.fetchOAuthUser( function (accessToken) {
+ var p = new Promise();
this.oauth.getProtectedResource(this.apiHost() + '/me', accessToken, function (err, data, response) {
if (err) return p.error(err);
var oauthUser = JSON.parse(data);
p.fulfill(oauthUser);
})
+ return p;
});

0 comments on commit 7200352

Please sign in to comment.