https://github.com/andresdotsh/nextjs-csrf-token
Next.js and csrf tokens
https://github.com/andresdotsh/nextjs-csrf-token
csrf csrf-tokens edge edge-runtime nextjs
Last synced: 4 months ago
JSON representation
Next.js and csrf tokens
- Host: GitHub
- URL: https://github.com/andresdotsh/nextjs-csrf-token
- Owner: andresdotsh
- Created: 2024-08-14T02:02:58.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-12-27T04:41:45.000Z (6 months ago)
- Last Synced: 2024-12-27T05:16:57.379Z (6 months ago)
- Topics: csrf, csrf-tokens, edge, edge-runtime, nextjs
- Language: TypeScript
- Homepage: https://next-csrf.vapor91.com
- Size: 105 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This project is a code example where the `@edge-csrf/core` library is implemented along with `Next.js` to generate and validate `CSRF tokens`.
Important files:
- `/src/constants.ts`
- `/src/utils/csrfTokens.ts`
- `/src/middleware.ts`
- `/src/actions/deleteCsrfCookieAction.ts`
- `/src/app/api/login/route.ts`
- `/src/app/components/Login/Login.tsx`
- `/src/app/page.tsx`## Details
👨💻 dev.to [post](https://dev.to/andresdotsh/csrf-tokens-in-nextjs-3mlb).
## Live demo
🚀 Live demo [here](https://next-csrf.vapor91.com).
## Run the project
Install dependencies
```bash
yarn install
```Run the development server:
```bash
yarn dev
```Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.