public()
Type: preHandlerHookHandler
Access: nauth.helpers.public()
Marks route as public, bypassing CSRF validation.
Signature
public(): preHandlerHookHandler
Usage
fastify.post('/auth/signup', {
preHandler: nauth.helpers.public(),
handler: nauth.adapter.wrapRouteHandler(async (req) => {
return nauth.authService.signup(req.body);
}),
});
fastify.post('/auth/login', {
preHandler: nauth.helpers.public(),
handler: loginHandler,
});
Behavior
- Skips CSRF token validation
- Does not require authentication
- Context still initialized by
clientInfohook