-
I didn't see any deprecation notices or any release notes regarding missing the following helper utilities: createAuthenticityToken() Was this on purpose or accident? I did go over the new docs and I haven't been able to get this new CSRF implementation to work. When calling csrf.validate() I always end up with an object. here's my current setup // root.tsx
// csrf.server
The internal parseCookie() function within validate() seems to return an object, of which I can see the csrf token, which matches the csrf token from AuthenticityTokenInput. But since it's an object it always gets caught within validate:
am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
The release notes mentioned a new cookie-based CSRF tokenYou shouldn't set the CSRF token in the session, save it in a separate cookie, if you use the same cookie for CSRF and the session it will fail because the session is stored as an object and the CSRF expects the cookie to be a string. |
Beta Was this translation helpful? Give feedback.
-
In root, how do you now go about setting multiple 'set-cookies' into the headers now? - 1 for auth and 1 for csrf in the return response. In the previous implementation didn't need to do this. I've tried:
but no luck. |
Beta Was this translation helpful? Give feedback.
-
@sergiodxa occasionally I am getting csrf validation errors:
I am deployed on vercel and am thinking this is happening after a new deployment but the user still has the "old" version still in the browser, can you think of why this would be happening? I would have thought it was signed with the same secret key and so should still be valid? |
Beta Was this translation helpful? Give feedback.
The release notes mentioned a new cookie-based CSRF tokenYou shouldn't set the CSRF token in the session, save it in a separate cookie, if you use the same cookie for CSRF and the session it will fail because the session is stored as an object and the CSRF expects the cookie to be a string.