This project has been created to learn how to implement JSON Web Token (JWT) and cookie-based authentication for only an administrator (admin) using Next.js.
Upon entering the correct password, a JWT token is generated successfully. This token is stored via browser cookies, and the login process is completed.
However, when the redirection process is conducted using NextResponse, the user appears as if they haven't logged in on the redirected page. The page still contains authentication checks that require the user to log in.
Surprisingly, when the user manually revisits the page, they appear as if they have logged in, and the auth process works correctly.