Next.js Discord

Discord Forum

Guys how do you implement authentication in nextjs app dir version with custom backend(java, node.js

Unanswered
Beans posted this in #help-forum
Open in Discord
Hi everyone, I'm looking for a tutorial on how to implement authentication using Next.js, app dir, while keeping some components working with SSR, without too many workarounds. My backend is being developed outside of Next.js. I need a tutorial; I don't want to use context authentication because it will only work on the client side. Is there another alternative?

1 Reply

if you have SSR, you are developing a nextJS backend, your just making ANOTHER backend.

your best bet for this scenario then is to pass the tokens and auth calls from backend to backend before you serve the SSR components

your biggest problem is, how are you expecting to do 0 auth in the front end? Im only guessing your situation, create a session token between front and backend in NextJS, then you have to store that session with a auth token that was generated from backend to backend