mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Describe a common mistake using csrftoken()
This commit is contained in:
parent
b28b6cd2fe
commit
63886178a6
1 changed files with 4 additions and 0 deletions
|
|
@ -793,6 +793,10 @@ If your plugin implements a ``<form method="POST">`` anywhere you will need to i
|
|||
|
||||
<input type="hidden" name="csrftoken" value="{{ csrftoken() }}">
|
||||
|
||||
If you are rendering templates using the :ref:`datasette_render_template` method the ``csrftoken()`` helper will only work if you provide the ``request=`` argument to that method. If you forget to do this you will see the following error::
|
||||
|
||||
form-urlencoded POST field did not match cookie
|
||||
|
||||
You can selectively disable CSRF protection using the :ref:`plugin_hook_skip_csrf` hook.
|
||||
|
||||
.. _internals_internal:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue