passport-localを使用している場合に、(データベースの例)エラーでcutomページにリダイレクトし、メッセージを表示する方法。コードは次のとおりです。
passport.use(new LocalStrategy({
passReqToCallback: true
}, function( req, username, password, done ) {
done({error:'mycustomerrormessage'});
}
));
ルーティングは次のようになります。
app.post('/auth/local', passport.authenticate('local', {
successRedirect: '/',
failureRedirect: '/',
failureFlash: true
}));
エラーが発生すると、URLは残り/auth/local
、厄介な[object Object]
内容になります。
電話したら
done( null, false, { message: "error message"})
パスポートがにリダイレクトするよりも、メッセージを表示/
できますが、最初のnotパラメーターを使用して関数flash
を呼び出し、そのエラーで何かを行う場合に、リダイレクトを設定するにはどうすればよいですか?verify
null