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