Guest User

Untitled

a guest
Jan 17th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. //All the necessary imports
  2.  
  3. const googleConfig = new GoogleStrategy(
  4. {
  5. clientID: process.env.GOOGLE_CLIENT_ID,
  6. clientSecret: process.env.GOOGLE_CLIENT_SECRET,
  7. callbackURL: '/auth/google/callback'
  8. },
  9. (accessToken, refreshToken, profile, done) => {
  10. //set the profile to req object in the form of req.object
  11. }
  12. );
  13.  
  14. passport.use(googleConfig);
  15.  
  16. app.use('/auth', passport.authenticate('google', {
  17. scope: ['profile']
  18. })); // Here I want to put anoter middleware that will take care of saving
  19. the data in the database but I do not know how to access the data
  20.  
  21. app.use('/auth/google/callback', passport.authenticate('google'),
  22. (req, res) => {
  23. res.send('You are loggedIn');
  24. });
Add Comment
Please, Sign In to add comment