Seems like other people have had similar issues, but the opposite direction... So trying to set up google authentication, and set up a call to passport on "/auth/google"
app.get('/auth/google', passport.authenticate('google', { scope : ['profile', 'email'] }));
// the callback after google has authenticated the user
app.get('/auth/google/callback',
passport.authenticate('google', {
successRedirect : '/internal',
failureRedirect : '/login',
failureFlash : true
}));
That works, if I go to 127.0.0.1/auth/google I get google login.
I then created a button to ask to be logged in
<a href="/auth/google"><button type="button" class="btn btn-default btn-lg">
<span class="glyphicon glyphicon-star" aria-hidden="true"></span> Login (Admin)
</button></a>
That button does send you to 127.0.0.1/auth/google, which the ngrouter takes as otherwise (.otherwise({ redirectTo: "/" });
)
And this is where my problem seems to be. Direct call to the server and it works, however, if I call it via angular, the router picks it up. So how do I force "angular" to ask the server for the page?
The auth set all is defined as app.get (as per the above example). I am not certain if this is because I am not defining these as express routes, they are under a module.export instead. In which case, is there a way to just tell express to pick these up and forward them internally or similar.