Next.js Discord

Discord Forum

Designing authentication and authorization for dashboard

Unanswered
Serengeti posted this in #help-forum
Open in Discord
SerengetiOP
Hey guys! I'm designing a dashboard based on next js 15 app router + sanity. Dashboard service is separate from main service on a subdomain.

My question: How would you protect a route when creating a dashboard? It is intended for use by only one user, aka admin. Is it worth setting up next-auth / other auth frameworks or would i be better off storing hashed password on sanity database?

2 Replies

Polar bear
Rolling your own auth is not recommended for a serious app. You can do it, but there are quite a few footguns to be aware of.

Check out https://authjs.dev/ and https://www.better-auth.com/docs/integrations/next
Also, make sure you understand the tradeoffs of using JWT vs Sessions