-
Notifications
You must be signed in to change notification settings - Fork 9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When using Try It Out with Open API 3, multiple cookie apiKeys are separated with & not ; as required by curl #4218
Comments
I have the same issue. |
There is a second issue at play here: the apiKey values are being UriEncoded, but they shouldn't be. Granted, it's vague what characters cookies allow, but I see cookie values unescaped in in the request the latest version of Chrome, so I'm guessing that is the standard. For example:
should be:
Please take this into account when fixing this bug. |
Update: judging by the reaction to #OAI/OpenAPI-Specification#1676, apiKey values in the cookie are wrongly being UriEncoded by swagger-ui. From the issue:
This means there is no reason to UriEncode apiKey parameter values in the cookie according to the spec, so please don't encode them in swagger-ui (as is currently the case). |
Catching up here - are we all talking about the cURL output, or is this being observed in the requests Swagger UI itself is sending out as well? |
@shockey I observed UriEncoded apiKey cookie values in Swagger UI in Chrome at first. Calls would not work in the browser, so I copied the curl command to a terminal for further testing. There I discovered that undoing UriEncoding of the apiKey cookie values made things work as expected. |
Hello All, do anyone know how to fix this? My problem is same as absurdist |
Anyone have a workaround? Issue has been open for over a year. How are you using cookies? |
Maybe to clarify the title, it is not required by curl it is required by http (all http web servers), https://tools.ietf.org/html/rfc6265#section-5.4 |
Sorry I'm stupid, my cookies were not being set due to an unrelated issue. I thought this was the reason, but I see now that this is indeed just an issue with how curl is formatted and not an issue with the functionality of cookies. |
Also having this issue. As a workaround, and pretty ugly one, you could instead defining a Security Scheme with
This would generate a curl command with the header The disadvantage is that you need to define this params for every route. Also the cookie values are defined as json in a text area from the UI instead of the nicer form available for Security Schemes. |
To add that I just stumbled over this same problem: we use "XML formatted cookies" (SAML assertions). For the given request the developer tool "Postman" generates the following command:
However when selecting "Try it out" in SwaggerUI (within Visual Studio Code, in case that matters) the generated curl command is like:
In other words: the "XML cookie" gets "URI encoded". Would be nice if this issue would be fixed ;) +1 from me anyway... |
This looks like the location where the ampersand separator is added: I'm not familiar enough with swagger to know whether replacing Related issue in the swagger-js repo: swagger-api/swagger-js#2358 |
When multiple API keys are specified in the security object, Try it Out separates the name value pairs with an ampersand. Curl expects a semi colon and the request will fail
_I'm attempting to locate the source of the error, am new to react and the code base, any guidance would be appreciated.
looks like the problem will be in the creation of the request headers prior to calling the curl formatting function in swagger-ui/src/core/curlify.js
But I'm still at the stage of fumbling around trying to orient myself in the code._
Demonstration API definition
Expected Behavior
Try it out should create a call like this:
or
see:
http://www.mit.edu/afs.new/sipb/user/ssen/src/curl-7.11.1/docs/curl.html
Current Behavior
Try it out produces this:
Context
This issue is preventing me from using swagger to demonstrate a new API over a system with a legacy security model that requires multiple cookie values to be passed
The text was updated successfully, but these errors were encountered: