diff --git a/flavors/swagger-ui-react/README.md b/flavors/swagger-ui-react/README.md index 02f4ac73..555a0916 100644 --- a/flavors/swagger-ui-react/README.md +++ b/flavors/swagger-ui-react/README.md @@ -158,6 +158,12 @@ If set, it persists authorization data and it would not be lost on browser close ⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. +#### `withCredentials`: PropTypes.bool + +If set to `true`, enables passing credentials, [as defined in the Fetch standard](https://fetch.spec.whatwg.org/#credentials), in CORS requests that are sent by the browser. Note that Swagger UI cannot currently set cookies cross-domain (see [swagger-js#1163](https://github.com/swagger-api/swagger-js/issues/1163)) - as a result, you will have to rely on browser-supplied cookies (which this setting enables sending) that Swagger UI cannot control. + +⚠️ This prop is currently only applied once, on mount. Changes to this prop's value will not be propagated to the underlying Swagger UI instance. A future version of this module will remove this limitation, and the change will not be considered a breaking change. + ## Limitations * Not all configuration bindings are available. diff --git a/flavors/swagger-ui-react/index.jsx b/flavors/swagger-ui-react/index.jsx index e39fa3c2..946d7c4c 100644 --- a/flavors/swagger-ui-react/index.jsx +++ b/flavors/swagger-ui-react/index.jsx @@ -35,6 +35,7 @@ export default class SwaggerUI extends React.Component { showExtensions: this.props.showExtensions, filter: ["boolean", "string"].includes(typeof this.props.filter) ? this.props.filter : false, persistAuthorization: this.props.persistAuthorization, + withCredentials: this.props.withCredentials, }) this.system = ui @@ -129,6 +130,7 @@ SwaggerUI.propTypes = { tryItOutEnabled: PropTypes.bool, displayRequestDuration: PropTypes.bool, persistAuthorization: PropTypes.bool, + withCredentials: PropTypes.bool, } SwaggerUI.defaultProps = {