mirror of
https://github.com/ditkrg/rswag.git
synced 2026-01-23 06:16:42 +00:00
Send Rails CSRF Token with swagger-ui requests
This commit is contained in:
parent
e10d8daa52
commit
9983261d4f
@ -64,6 +64,14 @@
|
||||
});
|
||||
|
||||
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) {
|
||||
log("Unable to Load SwaggerUI");
|
||||
|
||||
@ -64,6 +64,14 @@
|
||||
});
|
||||
|
||||
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) {
|
||||
log("Unable to Load SwaggerUI");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user