What's the recommended way of doing auth?
I'm doing a simple app, just to save my local snippets for now, but it will become a product, so I'll need authentication. The hono server rn is sending html (not an api).
There doesn't seem to be a good/simple solution for that in the docs, so what library is recommended for doing auth?
2 Replies
Is the fact that its sending html an issue? Do you want to use the html instead of the API or you want to use the API?
You can remove the html, I did the same and it works fine,
In terms of Auth, what kind of auth do you need? Hono provides middlewares like jwt to allow for authentication of the routes
here's the original thread: https://discord.com/channels/1011308539819597844/1324065998965444668
tl;dr
- hono is a fairly new library, built with cross-runtime compatibility and edge performance in mind. it doesn't come with robust catch-all solutions, and it leans towards functional patterns imo
- if you're looking for plug + play DX, it's probably not the right tool
- hono has middleware for basic + bearer auth, and a few out-of-box integrations for full-stack auth: https://hono.dev/docs/middleware/third-party
- if it's not on that list, reading/writing cookies is probably the biggest issue you'll run into vis-a-vis integrations, but you could try services like: supertokens, passport, auth0
i'm building auth rn using the new Lucia Auth pattern (not the lib). i think it's a solid option, though there currently aren't any hono examples, and the docs are a wip. obviously it's also a fair bit of work, so not the right answer for every project