Skip to content

rwx222/nextjs-csrf-token

Repository files navigation

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.

Live demo

🚀 Live demo here.

Run the project

Install dependencies

yarn install

Run the development server:

yarn dev

Open http://localhost:3000 with your browser to see the result.