We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3d01acf commit 45df744Copy full SHA for 45df744
graphene_django/static/graphene_django/graphiql.js
@@ -3,8 +3,11 @@
3
// Parse the cookie value for a CSRF token
4
var csrftoken;
5
var cookies = ('; ' + document.cookie).split('; csrftoken=');
6
- if (cookies.length == 2)
+ if (cookies.length == 2) {
7
csrftoken = cookies.pop().split(';').shift();
8
+ } else {
9
+ csrftoken = document.querySelector("[name=csrfmiddlewaretoken]").value;
10
+ }
11
12
// Collect the URL parameters
13
var parameters = {};
graphene_django/templates/graphene/graphiql.html
@@ -31,6 +31,7 @@
31
crossorigin="anonymous"></script>
32
</head>
33
<body>
34
+ {% csrf_token %}
35
<script src="{% static 'graphene_django/graphiql.js' %}"></script>
36
</body>
37
</html>
0 commit comments