CSRFTokenMismatchError
on API routes after upgrade to Blitz 2.0
#4127
-
Hey guys 😇 We freshly upgraded from Blitz 0.27.x to Blitz 2.0 🙌 Please correct me if I'm wrong 🙃 Blitz 0.27.x doesn't use In the case of integrations,that send requests to the API routes and reuse the received cookies, they receive the error What do you think is the best way to handle this situation? We thought about clearing the cookies in the integration every time. Do you have another idea? I hope I could make myself clear 😇 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Is it a possible idea to check the cookies in the following line too? |
Beta Was this translation helpful? Give feedback.
-
Hi @antonykamp, api endpoints for external integrations do not need anti-CSRF, and therefore usually should not wrap those endpoints with |
Beta Was this translation helpful? Give feedback.
Hi @antonykamp, api endpoints for external integrations do not need anti-CSRF, and therefore usually should not wrap those endpoints with
api()
. This api wrapper is new in blitz 2, removing it will give you exactly what you had before