BA
Better Auth•2mo ago
maderin

Is it safe to check the user session only in middleware and not in routes in Hono?

This is not recommended in Fullstack frameworks like SvelteKit and Nextjs. But with Hono, can we rely on this? I mean checking the session in a global middleware, and just returning 401 there if cannot get it... I believe yes, but I just want to double check, and also maybe some experienced person can update the documentation 🙂 https://www.better-auth.com/docs/integrations/hono
Hono Integration | Better Auth
Integrate Better Auth with Hono.
2 Replies
sebastian
sebastian•2mo ago
Yes its ok. It's literally in the documentation.
maderin
maderinOP•2mo ago
and also add validations for every route. you mean this... ? Would be nice to add them to examples too... If we have some doc maintainers that has more experience with hono / better-auth

Did you find this page helpful?