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

Swagger UI doesn't send cookie to backend #447

Open
chikko80 opened this issue Dec 10, 2022 · 4 comments
Open

Swagger UI doesn't send cookie to backend #447

chikko80 opened this issue Dec 10, 2022 · 4 comments
Labels
question Further information is requested

Comments

@chikko80
Copy link
Contributor

I've defined a security schema that extracts a refresh token from the cookie.

#[derive(SecurityScheme)]
#[oai(
    type = "api_key",
    key_name = "refresh_token",
    in = "cookie",
    checker = "valid_refresh_token"
)]
pub struct UserWithValidRefreshToken(User);

The cookie is present in the browser and the request runs fine if u do the curl request and append the cookie value manually. However, if I try to trigger the endpoint via the SwaggerUI, the backend doesn't receive any cookie.
What am I missing here?

@chikko80 chikko80 added the question Further information is requested label Dec 10, 2022
@TheCataliasTNT2k
Copy link

TheCataliasTNT2k commented Dec 22, 2022

@TheCataliasTNT2k
Copy link

It does not, because this is not really possible.
See link above:

Note for Swagger UI and Swagger Editor users: Cookie authentication is currently not supported for "try it out" requests due to browser security restrictions. See this issue for more information. SwaggerHub does not have this limitation.

You can use Postman, Insomnia and all of these instead.

@chikko80
Copy link
Contributor Author

chikko80 commented Jan 8, 2023

@TheCataliasTNT2k

Mhm, do you think we should close this?

@TheCataliasTNT2k
Copy link

No. This can not "repair" the functionality within the browser right now, but the feature is still missing in poem. There is a possibility to add it to swagger, so it should be done. When it works within the browser, this feature will be helpful, but for documentary reasons it is definitely a good idea, to inplement it even before that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants