Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.use('/api/admin/', (req, res, next) => {
const email = req.get('X-Auth-Email');
if (email) {
// TODO: need to do some verification of credentials here, probably
// validate X-Auth-Token signature
const user = new unleash.User({ email: `${email}` });
req.user = user;
next();
} else {
return res
.status('401')
.end('access denied');
}
});
(accessToken, refreshToken, profile, done) => {
done(
null,
new User({
name: profile.displayName,
email: profile.emails[0].value,
})
);
}
)