From 4f973701a9b91835be22b0c9d9c3ee1f3672c741 Mon Sep 17 00:00:00 2001 From: Chris Lynch Date: Mon, 6 Aug 2012 17:25:15 -0700 Subject: [PATCH 1/2] Added: Support for passing in a list of fields on the Facebook auth strategy. When instantiating the strategy use fields:"comma,separated,list". If no fields are set, the default /me is pulled from the Graph API. --- lib/auth.strategies/facebook.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/auth.strategies/facebook.js b/lib/auth.strategies/facebook.js index f8a8bdc..4228e10 100644 --- a/lib/auth.strategies/facebook.js +++ b/lib/auth.strategies/facebook.js @@ -16,6 +16,7 @@ module.exports= function(options, server) { my._redirectUri= options.callback; my.scope= options.scope || ""; my.display =options.display || "page"; + my.fields=options.fields || ""; // Give the strategy a name that.name = options.name || "facebook"; @@ -34,6 +35,8 @@ module.exports= function(options, server) { that.authenticate= function(request, response, callback) { //todo: makw the call timeout .... var parsedUrl= url.parse(request.originalUrl, true); + var fb_url = "https://graph.facebook.com/me" + (my.fields ? "?fields=" + my.fields : ""); + var self= this; this._facebook_fail= function(callback) { request.getAuthDetails()['facebook_login_attempt_failed'] = true; @@ -58,7 +61,8 @@ module.exports= function(options, server) { else { request.session["access_token"]= access_token; if( refresh_token ) request.session["refresh_token"]= refresh_token; - my._oAuth.getProtectedResource("https://graph.facebook.com/me", request.session["access_token"], function (error, data, response) { + + my._oAuth.getProtectedResource(fb_url, request.session["access_token"], function (error, data, response) { if( error ) { self._facebook_fail(callback); }else { From 7f5fde523a8995ae11c965afa1f9fc02f1cb3e28 Mon Sep 17 00:00:00 2001 From: Chris Lynch Date: Mon, 6 Aug 2012 17:29:36 -0700 Subject: [PATCH 2/2] Added: Support for all versions of Connect >= 2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 301f084..2c8400d 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "main" : "lib/index.js", "directories" : { "lib" : "./lib" }, "dependencies" : { - "connect": "2.0.0" + "connect": ">=2.0.0" , "oauth": "0.9.7" , "openid": "0.4.1" },