Live data from Hacker News

Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

news.ycombinator.com

31–40 of 112 posts

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#31
Tangentially related, but have you thought about a go to market strategy related to AI?

I started a new side project with Cursor to see how it goes, and it suggests a lot of packages for a lot of things (often not even suggests, assume you want it and ask you to install already).

I imagine there will be a “AIO” AI optimization field soon. Have you considered at all?

I mean. If I explicitly ask Cursor models to use Better Auth for authentication, will any of them be able to use it?

A possible thing for you to work on could be to prepare a prompt with links to your documentation that I can copy and paste in Cursor (or whatever) and will successfully implement it in my project.

EDIT: If you want to give it a try at one now and post as a reply here, I’ll gladly try it. It should say to substitute Auth0, as I am already using it, in a NextJS 15 web app that uses Neon serverless Postgres as DB. But I can tweak those myself later too

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#32
Congrats on the launch of Better Auth! It's great to see a new framework aiming to make rolling your own auth in TypeScript easier. More well-thought-out options for developers in the authentication and authorization landscape are always welcome.

Best of luck with it!

(Disclosure: I'm a co-founder of Zitadel, also building solutions in this space.)

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#33

I'm very tempted to make the leap from Lucia to Better Auth for a greenfield project, but the thought of jumping yet again from one auth solution to another is making me hesitate. If there are any satisfied (or unsatisfied) devs who have attempted the Lucia -> Better Auth transition, I'd love to hear your thoughts on this!

Hey I just converted my 0-user project from Lucia to Better Auth, and I had a few notes.

Better Auth is great - it just works, but there were a few quirks I had to face, like how it handles everything for you using the auth client instead of giving you helper functions to use to handle login/register requests and make it customizable on the server side

The migration was very easy, since I had no users to worry about, I was able to drop my users and sessions table and use the Better Auth cli to generate a migration with all the tables I could need. Even with some initial problems I had with the auth client and having to restructure my login errors to handle what the auth client returns, I'm happy with my migration, and it opens up a whole host of plugins and features I can easily integrate in the future

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#34
Does it handle:

- Federated sign-in/out? In next-auth, it is a giant pain to implement: https://github.com/nextauthjs/next-auth/discussions/3938

- Automated refreshing of JWT tokens on the client-side? I always end up having to implement my own logic around this. The big problem is if you have multiple API calls going out and they all require JWT auth, you need to check the JWT validity and block the calls until it is refreshed. In next-auth on the server-side, this is impossible to do since that side is generally stateless, and so you end up with multiple refresh calls happening for the same token.

- The ability to have multiple auth sessions at once, like in a SaaS app where you might belong to multiple accounts / organizations (your intro paragraph sounds like it does)

- Handle how multiple auth sessions are managed if the user happens to open up multiple tabs and swaps accounts in another tab

- Account switching using a Google provider? This seems to be a hard ask for providers like FusionAuth and Cognito. You can't use the Google connector directly but instead use a generic OAuth2 connector where you can specify custom parameters when making the initial OAuth2 flow with Google. The use-case is when a user clicks on the Google sign-in button, it should go to the Google account switcher / selector instead of signing in the user immediately if they have an existing signed-in Google session.

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#35
post #31

Tangentially related, but have you thought about a go to market strategy related to AI? I started a new side project with Cursor to see how it goes, and it suggests a lot of packages for a lot of things (often not even suggests, assume you want it and ask you to install already). I imagine there will be a “AIO” AI optimization field soon. Have you considered at all? I mean. If I explicitly ask Cursor models to use Be…

> I imagine there will be a “AIO” AI optimization field soon.

Please no.

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#36
post #33

I'm very tempted to make the leap from Lucia to Better Auth for a greenfield project, but the thought of jumping yet again from one auth solution to another is making me hesitate. If there are any satisfied (or unsatisfied) devs who have attempted the Lucia -> Better Auth transition, I'd love to hear your thoughts on this!

Hey I just converted my 0-user project from Lucia to Better Auth, and I had a few notes. Better Auth is great - it just works, but there were a few quirks I had to face, like how it handles everything for you using the auth client instead of giving you helper functions to use to handle login/register requests and make it customizable on the server side The migration was very easy, since I had no users to worry about,…

Thanks for sharing, you've successfully tipped the Better Auth scales for me... Might be too early to tell, but would you say you prefer Lucia or Better Auth at this point? I really like Lucia because of how little magic there is and how I can understand/control everything related to auth. But I wonder if it loses its luster as a project grows.

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#38
The closest I can think of is Devise for Ruby on Rails ecosystem. While these solution provides great developer experience to get started, IMHO there are solid reasons to have separate identity providers like Auth0 or if you like to self-host, stuff like Keycloak, Dex and more. Consider your business logic backend need multi-region deployments, where will you keep the auth DB?

Personally, if I want my app to be future proof, I would probably keep auth as a separate service while speaking standard protocols like OAuth2 so that I can maintain single source of truth for my user identity and be able to build multiple applications based on it.

Re: Launch HN: Better Auth (YC X25) – Authentication Framework for TypeScript

#40

Does it handle: - Federated sign-in/out? In next-auth, it is a giant pain to implement: https://github.com/nextauthjs/next-auth/discussions/3938 - Automated refreshing of JWT tokens on the client-side? I always end up having to implement my own logic around this. The big problem is if you have multiple API calls going out and they all require JWT auth, you need to check the JWT validity and block the calls until it i…

- Not right now, but there’s already an open issue and a PR in progress.

- We don’t use JWTs directly, and sessions always require state (it’s not stateless). And yeah, both the client and server handles automatic session refresh.

- Yes, we support both multiple sessions or having different organizations open in different tab: https://www.better-auth.com/docs/plugins/multi-session

- Yes, that’s possible, you just need to set the `prompt` parameter to `select_account`

Post reply on HN