From a1f135bd66ee625ff0299371a63b8b15f88ef1fc Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 13 Dec 2018 13:43:57 +0000 Subject: [PATCH] Allow oauth strategy callback method to be customised Closes #1998 Method can be set via: `adminAuth.strategy.options.callbackMethod` Can be either GET (default) or POST. --- .../node_modules/@node-red/editor-api/lib/auth/index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-api/lib/auth/index.js b/packages/node_modules/@node-red/editor-api/lib/auth/index.js index 158d0f77a..97e250f4a 100644 --- a/packages/node_modules/@node-red/editor-api/lib/auth/index.js +++ b/packages/node_modules/@node-red/editor-api/lib/auth/index.js @@ -182,7 +182,12 @@ function genericStrategy(adminApp,strategy) { passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }), completeGenerateStrategyAuth ); - adminApp.get('/auth/strategy/callback', + + var callbackMethodFunc = adminApp.get; + if (/^post$/i.test(options.callbackMethod)) { + callbackMethodFunc = adminApp.post; + } + callbackMethodFunc('/auth/strategy/callback', passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }), completeGenerateStrategyAuth );