···11+#!/usr/bin/env bash
22+33+echo "note: you might need to access via http://127.0.0.1:8888 (not localhost) for the iframe to get its cookies"
44+python3 -m http.server 8888
+9-4
who-am-i/src/server.rs
···33use axum::{
44 Router,
55 extract::{FromRef, Query, State},
66- response::{Html, Redirect},
66+ response::{Html, IntoResponse, Redirect},
77 routing::get,
88};
99-use axum_extra::extract::cookie::{Cookie, Key, SignedCookieJar};
99+use axum_extra::extract::cookie::{Cookie, Key, SameSite, SignedCookieJar};
10101111use serde::Deserialize;
1212use std::sync::Arc;
···5555 }
5656}
57575858-async fn prompt(jar: SignedCookieJar) -> (SignedCookieJar, Html<String>) {
5858+async fn prompt(jar: SignedCookieJar) -> impl IntoResponse {
5959 let m = if let Some(did) = jar.get("did") {
6060 format!("oh i know you: {did}")
6161 } else {
···8989 panic!("failed to do client callback");
9090 };
9191 let did = oauth_session.did().await.expect("a did to be present");
9292- let jar = jar.add(Cookie::new("did", did.to_string()));
9292+ let cookie = Cookie::build(("did", did.to_string()))
9393+ .http_only(true)
9494+ .secure(true)
9595+ .same_site(SameSite::None)
9696+ .max_age(std::time::Duration::from_secs(86_400).try_into().unwrap());
9797+ let jar = jar.add(cookie);
9398 (jar, Html(format!("sup: {did:?}")))
9499}