HOW TO SET MIDLLEWARE CSRF
Unanswered
Cesar Arreaza posted this in #help-forum
I hope you are very well. I am developing an app in next js and I need to implement a solution to prevent a CSFR attack, I found a tutorial where it is implemented here I leave the linkd of the information.(https://dev.to/adelhamad/csrf-protection-in-nextjs-1g1m)
I wanted to implement it like this but I get error enter image description here
This is the csrf.js file in the path /src/csrf.js enter image description here
Here is the login API in /src/pages/api/auth/login.js enter image description here
Here the frontend /src/pages/login.js enter image description here
I don't know what could be happening, thank you in advance.
For the process I used the "csurf" library: "^1.11.0", I don't know if there's something else I'm neglecting.
#next-auth
I wanted to implement it like this but I get error enter image description here
This is the csrf.js file in the path /src/csrf.js enter image description here
Here is the login API in /src/pages/api/auth/login.js enter image description here
Here the frontend /src/pages/login.js enter image description here
I don't know what could be happening, thank you in advance.
For the process I used the "csurf" library: "^1.11.0", I don't know if there's something else I'm neglecting.
#next-auth