From a23edca9380fc3f464c1358dced42a561173c267 Mon Sep 17 00:00:00 2001 From: aaldebs99 Date: Sun, 12 Oct 2025 01:11:47 +0000 Subject: [PATCH] fix(OIDC): redirect to frontend after OIDC credentials --- src/routes/auth.rs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/routes/auth.rs b/src/routes/auth.rs index 2ea11f2..e7e9351 100644 --- a/src/routes/auth.rs +++ b/src/routes/auth.rs @@ -189,7 +189,7 @@ async fn oidc_login(State(state): State>) -> Result>, Query(params): Query, -) -> Result, StatusCode> { +) -> Result { tracing::info!("OIDC callback called with params: code={:?}, state={:?}, error={:?}", params.code, params.state, params.error); @@ -324,10 +324,12 @@ async fn oidc_callback( StatusCode::INTERNAL_SERVER_ERROR })?; - Ok(Json(LoginResponse { - token, - user: user.into(), - })) + // Redirect to frontend with token in URL fragment + // The frontend should extract the token and store it + let redirect_url = format!("/#/auth/callback?token={}", urlencoding::encode(&token)); + tracing::info!("OIDC authentication successful for user: {}, redirecting to: {}", user.username, redirect_url); + + Ok(Redirect::to(&redirect_url)) } // Helper function to create a new OIDC user