redirect localhost instead of myserver.org:3000/login/callback

being redirected all the time to my localhost-server, instead of

myserver.org:3000/login/callback

to

localhost:3000/login/callback

do not understand why and where from

here part of my code:

app.get('/', function(req, res){
  res.render('index', { user: req.user });
});

app.get('/account', ensureAuthenticated, function(req, res){
  res.render('account', { user: req.user });
});


app.get('/login',
  passport.authenticate('saml', { failureRedirect: '/', failureFlash: true }),
  function(req, res) {
        console.log('so far worked out - =) 2');
    res.redirect('/');
  }
);

        console.log('so far worked out - =) 1');
app.post('/login/callback',
  passport.authenticate('saml', { failureRedirect: '/', failureFlash: true }),
  function(req, res) {
        console.log('so far worked out - =) 3');
//    res.redirect('');
        res.render('index', { user: req.user });
  }
);

app.get('/Metadata', // <--- also doesn't work 
        function(req,res){
console.log(SAML.prototype.validatePostResponse);
        console.log('so far worked out - =) 4');
        req.type('application/xml');
        res.send(200, samlStrategy.generateServiceProviderMetadata(cert));
    }
);

do not get the metadata... it doesn't print any of the console.log('so fa...') besides with the console.log('so fa... 1')

hope somebody sees the problem thank you in advance ... ;)

(similar topic here: redirect to localhost - stackoverflow )

I figured it out for my problem...

I was using exactly what the example provided, which included Feide OpenIdP AND the following code

issuer: 'passport-saml'

The issuer is an identification of what application is requesting authentication with (in this case) Feide OpenIdP. "passport-saml" is a pre-registered entity on Feide's OpenIdP network, which had an redirect link pre-defined in it to go back to localhost:3000

What you need to do is register your own entity entry on Feide OpenIdP and change the "issuer" in your code to whatever the name of the entity is that you registered. This should fix the problem.

Also note: I have my redirect url hard-coded on the Feide OpenIdP entity... I'm not sure how Feide OpenIdP would react if you did not specify the redirect URL in the entity. maybe it would redirect to whatever you have configured in the passport.use(new SamlStrategy()) call.

See also Node.js passport-saml redirects to localhost:3000/login/callback all the time where I basically do the same thing suggested above, but provide the example I used.