빠른 데이터 유효성 검사를 사용하고 있습니다. 좋습니다. 그러나 일부 데이터는 유효성 검사를 사용하여 확인하는 것이 실제적이지 않습니다 (예 : 페이스 북 토큰이 유효한지 확인하는 경우)req.validationErrors()에 사용자 정의 오류를 추가 하시겠습니까?
내가 생각할 수 없거나 최소한 할 수있는 유효성 검사를 수행 할 수있는 방법이 있습니까? 어떻게 든 수동으로 객체 등을 전달하여 오류를 추가합니까?
auth = (req, res, next) => {
//some setup:
res.locals.errors = [];
passport.authenticate('facebook-token', (err, user, info) => {
//this is where I would like to either validate with a custom validation or add this manually to whereever validationErrors get's it's values.
if(err && err.message === "Failed to fetch user profile"){
res.locals.errors.push({
param: 'access_token',
msg: 'Invalid access token',
value: req.query.access_token
});
}
})(req, res, next);
},