Skip to content

Commit 9f910d6

Browse files
committed
chore: update examples to match new initiate_oauth_login signature
1 parent 62039fa commit 9f910d6

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

examples/actix_github.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async fn index() -> impl Responder {
2222

2323
#[get("/auth/github")]
2424
async fn github_login(data: web::Data<AppState>) -> impl Responder {
25-
initiate_oauth_login(&data.github_flow, &["user:email"])
25+
initiate_oauth_login(&data.github_flow, &data.session_config, &["user:email"])
2626
}
2727

2828
#[get("/auth/github/callback")]

examples/axum_oauth.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,10 @@ async fn main() {
9595
google_flow,
9696
discord_flow,
9797
session_store,
98-
session_config: SessionConfig::default(),
98+
session_config: SessionConfig {
99+
secure: false,
100+
..Default::default()
101+
},
99102
};
100103

101104
let mut app = Router::new()
@@ -144,7 +147,7 @@ async fn index(State(state): State<AppState>) -> impl IntoResponse {
144147
// --- GitHub Handlers ---
145148
async fn github_login(State(state): State<AppState>, cookies: Cookies) -> Response {
146149
if let Some(flow) = &state.github_flow {
147-
initiate_oauth_login(flow, &cookies, &["user:email"]).into_response()
150+
initiate_oauth_login(flow, &state.session_config, &cookies, &["user:email"]).into_response()
148151
} else {
149152
(
150153
axum::http::StatusCode::NOT_IMPLEMENTED,
@@ -182,7 +185,8 @@ async fn github_callback(
182185
// --- Google Handlers ---
183186
async fn google_login(State(state): State<AppState>, cookies: Cookies) -> Response {
184187
if let Some(flow) = &state.google_flow {
185-
initiate_oauth_login(flow, &cookies, &["openid", "email", "profile"]).into_response()
188+
initiate_oauth_login(flow, &state.session_config, &cookies, &["openid", "email", "profile"])
189+
.into_response()
186190
} else {
187191
(
188192
axum::http::StatusCode::NOT_IMPLEMENTED,
@@ -220,7 +224,8 @@ async fn google_callback(
220224
// --- Discord Handlers ---
221225
async fn discord_login(State(state): State<AppState>, cookies: Cookies) -> Response {
222226
if let Some(flow) = &state.discord_flow {
223-
initiate_oauth_login(flow, &cookies, &["identify", "email"]).into_response()
227+
initiate_oauth_login(flow, &state.session_config, &cookies, &["identify", "email"])
228+
.into_response()
224229
} else {
225230
(
226231
axum::http::StatusCode::NOT_IMPLEMENTED,

examples/oidc_generic.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ async fn oidc_login(State(state): State<AppState>, cookies: Cookies) -> impl Int
9292
std::env::var("OIDC_SCOPES").unwrap_or_else(|_| "openid email profile".to_string());
9393
let scope_list: Vec<&str> = scopes.split_whitespace().collect();
9494

95-
initiate_oauth_login(&state.oidc_flow, &cookies, &scope_list)
95+
initiate_oauth_login(&state.oidc_flow, &state.session_config, &cookies, &scope_list)
9696
}
9797

9898
async fn oidc_callback(

0 commit comments

Comments
 (0)