Demo next auth using SSR not Client, save token to cookie.
Live Demo: https://next-auth-with-ssr.vercel.app
- Back to login page if try to protected page when unauthenticated
- Back to previous page if try to login when authenticated
- Return to login page when token is invalid
- Clone Project
git clone https://github.com/ntdat104/next-auth-with-ssr.git
- Install Packages
yarn install
- Using
yarn dev
โโโ src
โ โโโ apis
โ โโโ configs
โ โโโ constants
โ โโโ core
โ โโโ layouts
โ โโโ pages // include api routes (login, logout, verifyAuth)
โ โโโ styles
โ โโโ utils
โ โโโ views // define all pages
โโโ README.md