Skip to content
Browse files

Merge pull request #81 from edgji/master

allow post request for callback
  • Loading branch information...
2 parents f577431 + 0e0125b commit 1529abf0df599194eb735b8d37e15d3f403e8fb9 @raymondfeng raymondfeng committed
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/passport-configurator.js
View
5 lib/passport-configurator.js
@@ -169,6 +169,7 @@ PassportConfigurator.prototype.configureProvider = function(name, options) {
var authPath = options.authPath || ((link ? '/link/' : '/auth/') + name);
var callbackPath = options.callbackPath || ((link ? '/link/' : '/auth/') +
name + '/callback');
+ var callbackHTTPMethod = options.callbackHTTPMethod !== 'post' ? 'get' : 'post';
// remember returnTo position, set by ensureLoggedIn
var successRedirect = function(req){
@@ -519,7 +520,7 @@ PassportConfigurator.prototype.configureProvider = function(name, options) {
* Otherwise, authentication has failed.
*/
if (link) {
- self.app.get(callbackPath, passport.authorize(name, _.defaults({
+ self.app[callbackHTTPMethod](callbackPath, passport.authorize(name, _.defaults({
session: session,
// successReturnToOrRedirect: successRedirect,
successRedirect: successRedirect(),
@@ -534,6 +535,6 @@ PassportConfigurator.prototype.configureProvider = function(name, options) {
} else {
var customCallback = options.customCallback || defaultCallback;
// Register the path and the callback.
- self.app.get(callbackPath, customCallback);
+ self.app[callbackHTTPMethod](callbackPath, customCallback);
}
};

0 comments on commit 1529abf

Please sign in to comment.
Something went wrong with that request. Please try again.