Skip to content

Commit

Permalink
docs: added explanation section
Browse files Browse the repository at this point in the history
  • Loading branch information
kouts committed Sep 5, 2023
1 parent ada8dc8 commit 4333304
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion docs/content/1.getting-started/2.configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,9 @@ export default defineNuxtConfig({

## Using with tRPC Nuxt

In order to make the [CSRF](/security/csrf) functionality of this module work with [trpc-nuxt](https://github.com/wobsoriano/trpc-nuxt), we have to add the CSRF token value into a `csrf-token` header inside the outgoing request headers in our `trpc` client.
TRPC [uses `POST` requests](https://trpc.io/docs/rpc#methods---type-mapping) for the mutation endpoints. Using the CSRF protection functionality of this module with [trpc-nuxt](https://github.com/wobsoriano/trpc-nuxt) will help you protect your mutation endpoints from CSRF.

In order to make the [CSRF](/security/csrf) functionality of this module work with `trpc-nuxt`, we have to add the CSRF token value into a `csrf-token` header inside the outgoing request headers in our `trpc` client.

```ts
import { createTRPCNuxtClient, httpBatchLink } from "trpc-nuxt/client";
Expand Down

0 comments on commit 4333304

Please sign in to comment.