cenobites / flask-jsonrpc

Basic JSON-RPC implementation for your Flask-powered sites

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The CSRF token is missing when enabled CsrfProtect

wanghaiqing2015 opened this issue · comments

from flask_wtf import CsrfProtect
CsrfProtect(app)

from flask_jsonrpc import JSONRPC
jsonrpc = JSONRPC(app, '/JOB/script/call/jsonrpc2')
@jsonrpc.method('create_script_interface')
def get( ):
pass

the result is :

<title>400 Bad Request</title>

Bad Request

The CSRF token is missing.

This helped for me:

csrf_protect = CsrfProtect(app)
csrf_protect.exempt('flask_jsonrpc.wrapper')