Hello everyone,
I am doing project using nestjs + typeorm + graphql.
I want help about jwt authentication.
this is my code in main.ts file -
app.use((req, res, next) => {
const { authorization } = req.headers;
jwt.verify(authorization, '3EK6FD+o0+c7tzBNVfjpMkNDi2yARAAKzQlk8O2IKoxQu4nF7EdAh8s3TwpHwrdWT6R', (err, decodedToken) => {
if (err || !decodedToken) {
res.status(401).send('not authorized')
return
}
next()
})
});
this code applies jwt authentication for all resolvers, but I don't want to apply authentication for login & registration resolver.