Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andresdotsh/nextjs-csrf-token
NextJS 14 and csrf tokens
https://github.com/andresdotsh/nextjs-csrf-token
csrf csrf-tokens edge edge-runtime nextjs nextjs14
Last synced: about 1 month ago
JSON representation
NextJS 14 and csrf tokens
- Host: GitHub
- URL: https://github.com/andresdotsh/nextjs-csrf-token
- Owner: andresdotsh
- Created: 2024-08-14T02:02:58.000Z (4 months ago)
- Default Branch: main
- Last Pushed: 2024-08-23T04:48:41.000Z (4 months ago)
- Last Synced: 2024-08-23T05:47:45.772Z (4 months ago)
- Topics: csrf, csrf-tokens, edge, edge-runtime, nextjs, nextjs14
- Language: JavaScript
- Homepage:
- Size: 69.3 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 14` to generate and validate `CSRF tokens`.
Important files:
- `/src/constants.js`
- `/src/middleware.js`
- `/src/app/page.js`
- `/src/app/components/Login/Login.js`
- `/src/app/api/login/route.js`
- `/src/utils/csrfTokens.js`
- `/src/actions/deleteCsrfCookieAction.js`## Run the project
This is a [Next.js 14](https://nextjs.org/) project bootstrapped with [`yarn create next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
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.