Skip to content
Discussion options

You must be logged in to vote

I don't see a problem with that, but I wouldn't use a getServerSideProps just for that purpose. The CSRF token will be attached to each request so you could simply read it off of req.cookies I believe.

Although getCsrfToken does exactly that when you pass req to it, so you basically compare the cookie with itself.

You can see the logic involved validating the csrfToken in the source code here:

https://github.com/nextauthjs/next-auth/blob/main/src/server/lib/csrf-token-handler.js

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@igordanchenko
Comment options

Answer selected by igordanchenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #1928 on May 04, 2021 22:23.