Library recommendation for Authentication on React?
On React Ive only worked with Cognito but since Im not using AWS I dont know what else.
Ive built once an app doing from scratch but on Next.js.
Im also using monorepo (dont know if it gives any advantages for share code with server so)
14 Replies
If you don't want to do your own then Clerk is the new Auth kid in town.
Clerk.dev
If you want to roll your own then iron-session github will get you going. It uses a stateless cookie.
iron session github isnt for next.js? (just had a quick look)
I use it in next with app directory and even trpc
GitHub
GitHub - vvo/iron-session: 🛠 Next.js stateless session utility usin...
🛠 Next.js stateless session utility using signed and encrypted cookies to store data. Also works with Express, and Node.js HTTP servers - GitHub - vvo/iron-session: 🛠 Next.js stateless session util...
a lot of work if you just want a client login though
emails and such for passwords etc
next-auth is another option
NextAuth.js
Authentication for Next.js
I use iron session because it is an app for businesses where HR makes accounts. No need for social logins.
The other options come with social logins but you give up controls of the user DB
nextauth is oss and you control DB, clerk is paid for with other features(emails, pasword reset,all the stuff you would expect), iron session is raw cookie storage on server
Lucia Documentation
Lucia
@MonobrainChris @nyx (Rustular DevRel) but isnt all of them for next? Im not using Next!
What are you using?
No, expect for iron session
They are moving nextauth towards this https://authjs.dev
Auth.js
Authentication for the Web.
its still experimental though
and lucia has quite few options for using it