June 2014
Intermediate to advanced
696 pages
38h 52m
English
Passport is fully configured now, and you are ready to implement the middleware in your application’s routes. The next step is to add the passport.authenticate() method to your authentication route. The authentication method accepts the authentication source as the first parameter and then an object that contains successRedirect and failureRedirect sources. In the case of Google, a double authentication must take place, as shown in the routes below:
app.get('/auth/google', passport.authenticate('google'));app.get('/auth/google/return', passport.authenticate('google', { successRedirect: '/info', failureRedirect: '/login' }));
You can also use the req.login() method ...
Read now
Unlock full access