mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-25 07:16:40 +00:00
Send Rails CSRF Token with swagger-ui requests
This commit is contained in:
@@ -64,6 +64,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
addApiKeyAuthorization();
|
addApiKeyAuthorization();
|
||||||
|
|
||||||
|
// Send Rails CSRF Token with every request
|
||||||
|
var csrfToken = new SwaggerClient.ApiKeyAuthorization(
|
||||||
|
'X-CSRF-Token',
|
||||||
|
'<%= form_authenticity_token %>',
|
||||||
|
'header'
|
||||||
|
);
|
||||||
|
swaggerUi.api.clientAuthorizations.add('csrf-token', csrfToken);
|
||||||
},
|
},
|
||||||
onFailure: function(data) {
|
onFailure: function(data) {
|
||||||
log("Unable to Load SwaggerUI");
|
log("Unable to Load SwaggerUI");
|
||||||
|
|||||||
@@ -64,6 +64,14 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
addApiKeyAuthorization();
|
addApiKeyAuthorization();
|
||||||
|
|
||||||
|
// Send Rails CSRF Token with every request
|
||||||
|
var csrfToken = new SwaggerClient.ApiKeyAuthorization(
|
||||||
|
'X-CSRF-Token',
|
||||||
|
'<%= form_authenticity_token %>',
|
||||||
|
'header'
|
||||||
|
);
|
||||||
|
swaggerUi.api.clientAuthorizations.add('csrf-token', csrfToken);
|
||||||
},
|
},
|
||||||
onFailure: function(data) {
|
onFailure: function(data) {
|
||||||
log("Unable to Load SwaggerUI");
|
log("Unable to Load SwaggerUI");
|
||||||
|
|||||||
Reference in New Issue
Block a user