I apologize, this question turned out to be a bit long, but I worked on it for some time and really needed an explanation of the whole story.
Background : The application is based on the MEAN stack, trying to authorize Facebook logins using Passport.js.
The following Passport.js guide I implemented something similar to:
<a href="/connect/facebook" target="_self">Add a Facebook login</a>
app.get('/connect/facebook',isLoggedIn, passport.authorize('facebook',
{ scope : 'email' })
);
app.get('/connect/facebook/callback',
passport.authorize('facebook', {
successRedirect : '/profile',
failureRedirect : '/profile'
}));
Pay attention to target=_selfin html to skip Angular routing. Clearly, authorization is working fine. However, redirection does not work, as routing is done using Angular. After logging in, I never land on /profile(but by default Angular).
, Passport.js , json Angular, Angular . - :
$http.get("/connect/facebook").success(function(data){
});
app.get('/connect/facebook',isLoggedIn,passport.authorize('facebook',
{ scope : 'email' })
);
app.get('/connect/facebook/callback',function(req, res, next) {
passport.authorize('facebook', function(err, user, info) {
res.json({something:smtg});
...
, , Passport.js. ? /connect/facebook Angular, json /connect/facebook/callback.
Passport, - , /profile FB, , ? .
:
Passport-Facebook GitHub. , .