It is tempting to generate the token once per request and have
multiple windows in the browser share the token via javascript's
session local storage. But there are a number of race conditions,
including not being able to submit a new request in the interval
between the server sending a response and the browser receiving
the response. Per-request CSRF tokens are just too much bother
for what you get.
csrf_token Token for detecting CSRF.
'''
response = super().write(result, errors)
- response['csrf_token'] = self.session.new_csrf_token()
+ response['csrf_token'] = self.session.get_csrf_token()
return response