Merge branch 'oauth2_results_callback' into merge_mayhem

This commit is contained in:
ciaranj 2012-04-24 20:45:22 +01:00
commit 1359d695d2
3 changed files with 34 additions and 20 deletions

View File

@ -10,6 +10,7 @@ Also provides rudimentary OAuth2 support, tested against facebook connect and gi
Change History
==============
* 0.10.0 - OAuth2: Pass back any extra response data for calls to getOAuthAccessToken (Thanks to Tang Bo Hao)
* 0.9.6 - Support for 302 redirects on OAuth2 (Thanks Patrick Negri). Some code tidying. ( Thanks to Raoul Millais )
* 0.9.5 - Allow usage of HTTP verbs other than GET for retrieving the access and request tokens (OAuth1) (Thanks to Raoul Millais)
* 0.9.4 - Support for OAuth providers that drop connections (don't send response lengths? [Google]) And change OAuth2 getOAuthAccessToken to POST rather than GET ( Possible Breaking change!!! ... re-tested against Google, Github, Facebook, FourSquare and Janrain and seems ok .. is closer to the spec (v20) )
@ -39,3 +40,4 @@ Contributors
* Ryan LeFevre - http://meltingice.net
* Raoul Millais
* Patrick Negri - http://github.com/pnegri
* Tang Bo Hao - http://github.com/btspoony

View File

@ -136,7 +136,7 @@ exports.OAuth2.prototype.getOAuthAccessToken= function(code, params, callback) {
var access_token= results["access_token"];
var refresh_token= results["refresh_token"];
delete results["refresh_token"];
callback(null, access_token, refresh_token);
callback(null, access_token, refresh_token, results); // callback results =-=
}
});
}

View File

@ -22,6 +22,18 @@ vows.describe('OAuth2').addBatch({
assert.equal( access_token, "access");
assert.equal( refresh_token, "refresh");
});
},
'we should return the received data to the calling method': function (oa) {
oa._request= function(method, url, headers, post_body, access_token, callback) {
callback(null, '{"access_token":"access","refresh_token":"refresh","extra_1":1, "extra_2":"foo"}');
};
oa.getOAuthAccessToken("", {}, function(error, access_token, refresh_token, results) {
assert.equal( access_token, "access");
assert.equal( refresh_token, "refresh");
assert.isNotNull( results );
assert.equal( results.extra_1, 1);
assert.equal( results.extra_2, "foo");
});
}
}
}).export(module);