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

https://github.com/kentcdodds/epic-stack-with-csrf

An example of the Epic Stack with CSRF protection on forms
https://github.com/kentcdodds/epic-stack-with-csrf

epic-stack epic-stack-example

Last synced: 11 months ago
JSON representation

An example of the Epic Stack with CSRF protection on forms

Awesome Lists containing this project

README

          

# Epic Stack with CSRF Protection

This is an example of how to integrate the
[`remix-utils`](https://github.com/sergiodxa/remix-utils) package utilities for
[Cross-Site Request Forgery (CSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery)
protection with the Epic Stack. The easiest way to explore the example is to
pull up
[the commit history](https://github.com/kentcdodds/epic-stack-with-csrf/commits/main).

Following the steps laid out in the Remix Utils docs is sufficient for this:

1. Install `remix-utils`
2. Generate the authenticity token in the `root.tsx` loader (be certain to
commit the session to set the cookie)
3. Wrap the App in the `` and provide the token
4. Render a Form with the `` component
5. Verify in the Action using `verifyAuthenticityToken` and the session.