Currently, I am delving into the realm of Next.js 13 for development with little familiarity in Server-Side Rendering (SSR).
The obstacle I face pertains to utilizing my own backend API built on Express.js.
This backend service already supports essential authentication functionalities such as login, signup, logout, and social login via Google.
My intention is to stick with my existing backend authentication setup instead of switching to Next.js's next-auth
system. My rationale behind this decision includes:
Next.js seems more geared towards frontend development rather than full-stack applications in my perspective.
Given that my backend infrastructure is robustly established, I prefer leveraging its authentication features.
My current approach involves fetching cookies from the server fetch (next.js) to validate the user's login status, which has been functioning adequately so far considering my novice level.
I am interested to explore alternative methods of authenticating using my backend API without relying on next-auth
. I am keen on evaluating different tactics to see if this strategy holds merit.
On the frontend side,
The cookies obtained through server-side data fetching contain JWT tokens, which I decoded to display the user's username on the navbar.