I'm making the backend for a side project of mine where I need Google sign in through OIDC. The signing in part works, but when I go to store the session, it doesn't keep the cookie.
I configure axum_sessions as such
let session_store = MemoryStore::new();
let mut session_secret = [0u8; 256];
rand::thread_rng().fill(&mut session_secret);
let session_layer = SessionLayer::new(session_store, &session_secret)
.with_persistence_policy(PersistencePolicy::ChangedOnly)
.with_cookie_domain("localhost:8080")
.with_cookie_name("session")
.with_cookie_path("/")
.with_secure(false);
Then, in the OIDC callback, I do
if session.insert("email", email).is_err() {
return (
StatusCode::INTERNAL_SERVER_ERROR,
"Failed to update session",
)
.into_response();
}
Redirect::temporary("/").into_response()
I see the set-cookie header in dev tools, but the cookie then just disappears into the ether, and I end up in an endless cycle of logging in. Anyone have an idea?