Blankeos
Explore posts from serversHow to implement Oauth in Hono?
Great then Lucia would be great for you!
I don't have an example repo unfortunately. The repos I worked on are not public.
I really just have to recommend the docs for you. Looking at these examples is already good enough tbh: https://github.com/lucia-auth/examples
Few things you should note when building (from my experience):
1. Setup your Database + ORM (Drizzle or Prisma)
2. Instantiate Lucia (this will be based on either your DB driver or your ORM). Lucia has "Adapters" for those.
3. Define the tables that Lucia needs. Mainly just 1 for users, and 1 for sessions.
Then, the rest of the hard parts are just setting up your controllers or resolvers or services.
---
I also referred to this repo by Ben Davis quite a bit (Luckily it has implementations for GitHub and Google already which is cool) https://github.com/bmdavis419/SvelteKit-Ecommerce/tree/main/src/routes/auth/callback
I was implementing mine on ElysiaJS by the way.
10 replies
When there's an error on my typescript code on Hono, Vite Dev Server crashes, and doesn't restart
2 replies
How to implement Oauth in Hono?
Try Lucia if you're up for it. lucia-auth.com/
It's definitely not for beginners though. Setting it up is like hours of "ohhh, now i get it".
It taught me some valuable auth concepts in the end tho.
---
You can probably check this out as well: https://github.com/honojs/middleware/tree/main/packages/auth-js
---
If you want faster options, you could use a third-party auth service: Kinde, Clerk, Firebase, Supabase.
10 replies