Bernardo Rebelo
Bernardo Rebelo

Reputation: 119

PassportJS Auth with JWT and Goolge

So when I try to auth a user in the api with jwt or google the passport.authenticate redirects to google

passport.authenticate(["jwt", "google"], { session: false, scope: ["profile", "email"] })

enter image description here

I can't figure out how to change it when I try doing a custom middleware it always bugs out with passport.authenticate(), How can I make this work

EDIT: This middleware seemed to work fine,

  function checkAuthenticated(req, res, next)  {
        if (req.isAuthenticated()) { return next() }
        passport.authenticate("jwt", { session: false })(req, res, next);
   }

Hoping for a better solution or fix.

Upvotes: 1

Views: 27

Answers (0)

Related Questions