Novel maintains a session for each client that comes in via a session cookie. This is handled by https://github.com/fastify/fastify-secure-session. Both application and admin context's are supported.
You can access this session via the request variable in your handler.
export default function Route(instance) {
instance.authenticated();
instance.get('/your/route', handler);
async function handler () {
reply.send('ONLY FOR AUTHENTICATED USERS');
}
}
await request.authenticated();
export default function Route(instance) {
instance.authorized();
instance.get('/your/route', handler);
async function handler () {
reply.send('ONLY FOR AUTHENTICATED API KEYS');
}
}