Support for CORS with credentials
See original GitHub issueWhen Swagger API is authenticated through cookie, Swagger GUI running on different host cannot access it because it doesn’t pass on cookie. Swagger JS should be setting flag withCredentials
to true
to enable browser to pass on cookie to the Swagger API.
Example of enabling this for jQuery:
$.ajax({ url: a_cross_domain_url, xhrFields: { withCredentials: true } });
References:
Issue Analytics
- State:
- Created 9 years ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Access-Control-Allow-Credentials - HTTP - MDN Web Docs
The Access-Control-Allow-Credentials response header tells browsers whether to expose the response to the frontend JavaScript code when the ...
Read more >What exactly does the Access-Control-Allow-Credentials ...
I'm trying to understand how to use CORS and am confused about what the Access-Control-Allow ...
Read more >Include credentials on cross-origin requests
Go to Site, CORS and click default to select the Allow Credentials check box. For example: When you access http://sxa from http://fake ,...
Read more >How do I send a CORS request with Credentials? - ReqBin
To send a CORS request with credentials, you must provide an Origin request HTTP header and an authorization cookie. CORS (Cross-Origin ...
Read more >Top Five CORS Issues You Don't Want To Run Into
Access Control Allow Origin header in response must not be wildcard * ... Well the problem is, if you're sending some credentials like...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Now you can enable withCredentials by passing enableCookies=true to SwaggerClient. https://github.com/swagger-api/swagger-js/pull/891
new Swagger({ url: a_cross_domain_url, enableCookies: true });
@LiorArbel @DonMartin76, take a look at https://github.com/swagger-api/swagger-js/pull/1189 - it may cover your use case 😄