私は、自分のWebアプリケーションで認証中cookie
に単純に設定しようとしています。JSON Web Token
Node.js
Express
res.redirect
を使用した後はできないのでres.cookie()
、どうすればこれを達成できますか?
router.post('/', function(req, res, next) {
passport.authenticate('local', function(err, user, info) {
if (!user) { return res.redirect('/auth'); }
var theToken = jwt.encode({ id : user.id }, req.app.get('appSecret'));
res.cookie(theToken);
return res.redirect('/profile/' + username);
})(req, res, next);
});
この問題に正しく取り組んでいますか? 作成した後、人々が をどのように設定しているかについては、ほとんど何も見つかりませんJSON Web Token
。