Better Error Logging for Generating Token

This commit is contained in:
BloxerHD 2026-07-02 20:12:10 +01:00 committed by red binder
commit 517a9fad39

View file

@ -40,7 +40,7 @@ async fn gen_token(Json(payload): Json<GenerateTokenRequest>) -> Result<Json<Tok
let client_secret = match env::var("ACCOUNT_CLIENT_SECRET") {
Ok(secret) => secret,
Err(_) => {
println!("No account client secret specified - Token generation will always fail");
println!("[/api/v1/login/generate_token] No account client secret specified - Token generation will always fail");
return Err(StatusCode::INTERNAL_SERVER_ERROR)
},
};
@ -65,7 +65,10 @@ async fn gen_token(Json(payload): Json<GenerateTokenRequest>) -> Result<Json<Tok
match body {
Ok(b) => return Ok(Json(b)),
Err(_) => return Err(StatusCode::BAD_GATEWAY)
Err(e) => {
println!("[/api/v1/login/generate_token] Failed to parse token data from upstream: {}", e);
return Err(StatusCode::BAD_GATEWAY)
},
};
},
Err(e) => match e.status() {