Skip to content
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

Rust SDK doesn't allow to access cookies of a request #295

Open
3 of 5 tasks
akkie opened this issue Sep 30, 2023 · 2 comments
Open
3 of 5 tasks

Rust SDK doesn't allow to access cookies of a request #295

akkie opened this issue Sep 30, 2023 · 2 comments
Labels
bug Something is not working.

Comments

@akkie
Copy link

akkie commented Sep 30, 2023

Preflight checklist

Describe the bug

The rust SDK returns only the flow object and therefore it's not possible to access cookies from the response to forward them.

As example: The JS SDK returns a AxiosPromise which contains the complete response. The rust SDK returns only the flow object.

Therefore it's not possible to forward the CSRF cookie to the client if I call create_browser_login_flow as example.

Reproducing the bug

Call the create_browser_login_flow of the rust crate.

Version

1.0.0

On which operating system are you observing this issue?

macOS

In which environment are you deploying?

Docker

@akkie akkie added the bug Something is not working. label Sep 30, 2023
@akkie
Copy link
Author

akkie commented Oct 3, 2023

I could look into the issue but I need to know first, is there a special reason why you use a custom template instead of one of the supported rust templates? https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/rust

@akkie
Copy link
Author

akkie commented Oct 3, 2023

After looking into it a bit more, it turns out that there are several things that need to be done, and that it may affect some of the SDKs that are generated, because the way it's implemented for some clients is not the way it should work.

The first thing that needs to be done, is to document response headers in your spec as pointed out in the documentation: https://spec.openapis.org/oas/v3.1.0#response-object

There is currently an issue with multiple headers of the same name. For some APIs, there are multiple Set-Cookie headers returned and the way how headers are defined (key-value pairs) doesn't allow to define multiple headers with the same name. There is a workaround which uses null bytes to define multiple Set-Cookie headers.

The second thing is that the code generators needs to implement the handling of this response headers. There are currently open feature requests for many languages:
OpenAPITools/openapi-generator#16111
OpenAPITools/openapi-generator#13403
OpenAPITools/openapi-generator#12855
OpenAPITools/openapi-generator#12403

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

No branches or pull requests

1 participant