Handle Authentication Without "/api" routes
Unanswered
Asian black bear posted this in #help-forum
Asian black bearOP
I have an existing Express Backend which is serving backend for my web app and mobile apps as well. I want to replace the webapp with NextJS app.
Before starting, I am confused about how to handle the authentication. I saw a lot of tutorials and all of the them are using "/api" routes which I don't want to use since I already have a backend and I want to use that.
Please help me understand how to achieve this.
Before starting, I am confused about how to handle the authentication. I saw a lot of tutorials and all of the them are using "/api" routes which I don't want to use since I already have a backend and I want to use that.
Please help me understand how to achieve this.
6 Replies
European sprat
Maybe you were reading about people using next-auth? If you want to roll your own auth there's no issue in doing that
Asian black bearOP
Can you please point me to some documentation? I just want to use my own backend and not the "/api" routes.
European sprat
there's no specific documentation for auth
you could maybe look at next-auth and see if there's a way to plug in your existing backend
i just use jwts in cookies and check them in middleware, server components and when API routes are used
Asian black bearOP
Alright. Thanks. I'll keep looking around.