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/igdev116/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