Answer the question
In order to leave comments, you need to log in
Do I need to use serializeUser and deserializeUser when authorizing via passport-steam + jwt?
const SteamStrategy = new Strategy({
returnURL: 'http://localhost:5000/auth/steam/return',
realm: 'http://localhost:5000/',
apiKey: 'key'
}, (identifier, { id }, done) => done(null, id))
router.get('/steam/return', passport.authenticate('steam'), ({ user }, res) => {
//чек юзера
const token = createToken(user)
console.log(token)
res.cookie('jwt', token).redirect('http://localhost:8080/')
})
router.get('/is-logged', async (req, res) => {
const json = { user: null }
const token = req?.cookies?.jwt
const steamid = checkToken(token)
if (!token || !steamid) return res.status(200).json(json)
json.user = await getUser({ steamid })
return res.status(200).json(json)
})
passport.serializeUser((user, done) => done(null, user))
passport.deserializeUser((obj, done) => done(null, obj))
app.use(passport.session())
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question