mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
[fix] github oauth strategy when Root is not / (#1430)
This commit is contained in:
parent
0634a97598
commit
140ea683a6
@ -89,7 +89,7 @@ function login(req,res) {
|
|||||||
} else if (settings.adminAuth.type === "strategy") {
|
} else if (settings.adminAuth.type === "strategy") {
|
||||||
response = {
|
response = {
|
||||||
"type":"strategy",
|
"type":"strategy",
|
||||||
"prompts":[{type:"button",label:settings.adminAuth.strategy.label, url:"/auth/strategy"}]
|
"prompts":[{type:"button",label:settings.adminAuth.strategy.label, url: settings.httpAdminRoot + "auth/strategy"}]
|
||||||
}
|
}
|
||||||
if (settings.adminAuth.strategy.icon) {
|
if (settings.adminAuth.strategy.icon) {
|
||||||
response.prompts[0].icon = settings.adminAuth.strategy.icon;
|
response.prompts[0].icon = settings.adminAuth.strategy.icon;
|
||||||
@ -186,12 +186,12 @@ module.exports = {
|
|||||||
|
|
||||||
adminApp.get('/auth/strategy', passport.authenticate(strategy.name));
|
adminApp.get('/auth/strategy', passport.authenticate(strategy.name));
|
||||||
adminApp.get('/auth/strategy/callback',
|
adminApp.get('/auth/strategy/callback',
|
||||||
passport.authenticate(strategy.name, {session:false, failureRedirect: '/' }),
|
passport.authenticate(strategy.name, {session:false, failureRedirect: settings.httpAdminRoot }),
|
||||||
function(req, res) {
|
function(req, res) {
|
||||||
var tokens = req.user.tokens;
|
var tokens = req.user.tokens;
|
||||||
delete req.user.tokens;
|
delete req.user.tokens;
|
||||||
// Successful authentication, redirect home.
|
// Successful authentication, redirect home.
|
||||||
res.redirect('/?access_token='+tokens.accessToken);
|
res.redirect(settings.httpAdminRoot + '?access_token='+tokens.accessToken);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user