Cookies in OpenApi #164
Unanswered
Christoph-AK
asked this question in
Q&A
Replies: 1 comment 1 reply
-
You can use the use poem::session::Session;
use poem::session::CookieSession;
#[OpenApi]
impl Api {
#[oai(path = "/", method = "post")]
async fn do_something(&self, session: &Session) {
}
}
let api_service = OpenApiService::new(Api , "test", "1.0");
let app = Route::new().nest("/api", api_service)
.with(CookieSession::new(CookieConfig::default())); // <<<< use session middleware |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there, what is the intended way to set cookies with openapi?
I would love to store a token in a cookie and later retrieve it as parameter in an oai function.
I kinda see a way where I host an extra path with a 'non-openapi'-Poem-Endpoint or maybe a transform for my login endpoint, but that both seems like a lot of extra work and redundant code needed.
Beta Was this translation helpful? Give feedback.
All reactions