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 does not set ACCEPT header #301

Open
3 of 5 tasks
tomtom5152 opened this issue Oct 30, 2023 · 1 comment
Open
3 of 5 tasks

Rust SDK does not set ACCEPT header #301

tomtom5152 opened this issue Oct 30, 2023 · 1 comment
Labels
bug Something is not working.

Comments

@tomtom5152
Copy link

Preflight checklist

Ory Network Project

No response

Describe the bug

When using kratos-client-rust in WASM, the ACCEPT header is set to */* for all requests, resulting in 303 redirect requests on browser flow endpoints.

It is unclear if this is as a result of a lack of functionality in openapi-generator or if the custom Ory templates do not include the necessary lines as the header is set in other SDKs.

This could also be by design, however there is no way to set the ACCEPT header meaning the browsers tested will automatically follow the 303 response in the AJAX request, and other SDKs such as Go do explicitly set this to application/json.

Reproducing the bug

  1. Setup self hosted kratos
  2. call ory_kratos_client::apis::frontend_api::create_browser_login_flow from a rust project, specifically WASM
  3. Observe a XHR request with Accept: */*
  4. Receive a 303 response redirecting to the login UI as if directly accessed from the browser instead of the expected 200 with JSON response.

Relevant log output

No response

Relevant configuration

No response

Version

1.0.0

On which operating system are you observing this issue?

Other

In which environment are you deploying?

Other

Additional Context

Running in a Yew v0.21.0 Rust WASM app bundled with Trunk v0.17.5.

Tested against Kratos 1.0.0 in Chrome 118.0.5993.117 and Safari 17.0 on macOS, however the line parameters are missing from the generated rust sources meaning it could be undefined behavior.

@tomtom5152 tomtom5152 added the bug Something is not working. label Oct 30, 2023
@tysen
Copy link

tysen commented Nov 16, 2023

You can set the default_headers of the reqwest::Client (when you build it) in the Configuration struct you pass to e.g. create_browser_login_flow.

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

2 participants