Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

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.