From c129f8914d59932e91073d0cabaea36fde225e6b Mon Sep 17 00:00:00 2001 From: XiaozhongLiu Date: Sun, 15 Jan 2017 00:57:36 +0800 Subject: [PATCH] fix an err in oauth midware when requesting /oauth/logout, the relevant if branch of "logoutPath" won't get reached. because the url will match /oauth , the if branch of "loginPath" will intercept the execution. --- lib/oauth_middleware.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/oauth_middleware.js b/lib/oauth_middleware.js index 8dcc51c..b0a05db 100644 --- a/lib/oauth_middleware.js +++ b/lib/oauth_middleware.js @@ -141,10 +141,10 @@ module.exports = function oauth(options) { return function (req, res, next) { if (req.url.indexOf(options.callbackPath) === 0) { oauthCallback(req, res, next, options); - } else if (req.url.indexOf(options.loginPath) === 0) { - login(req, res, next, options); } else if (req.url.indexOf(options.logoutPath) === 0) { logout(req, res, next, options); + } else if (req.url.indexOf(options.loginPath) === 0) { + login(req, res, next, options); } else { next(); }