diff --git a/libpaket/src/advices/briefankuendigung.rs b/libpaket/src/advices/briefankuendigung.rs index f4e3788..7a0d9d1 100644 --- a/libpaket/src/advices/briefankuendigung.rs +++ b/libpaket/src/advices/briefankuendigung.rs @@ -1,10 +1,10 @@ pub use super::Advice; use super::AdvicesResponse; -use reqwest::header::HeaderMap; -use serde::Serialize; use crate::constants::webview_user_agent; use crate::LibraryResult; +use reqwest::header::HeaderMap; +use serde::Serialize; pub struct AdviceClient { client: reqwest::Client, @@ -27,7 +27,10 @@ impl AdviceClient { pub async fn access_token<'t>(&self, advices: &AdvicesResponse) -> LibraryResult { mini_assert_inval!(advices.has_any_advices()); - mini_assert_api_eq!(advices.access_token_url.as_ref().unwrap().as_str(), endpoint_access_tokens()); + mini_assert_api_eq!( + advices.access_token_url.as_ref().unwrap().as_str(), + endpoint_access_tokens() + ); let req = self .client @@ -46,10 +49,13 @@ impl AdviceClient { let res = res.unwrap(); for cookie in res.cookies() { - if cookie.name() == "UAT" { + println!("UAT: cookie: {:?}={:?}", cookie.name(), cookie.value()); + if cookie.name() == "AccessToken" { return Ok(UatToken(cookie.value().to_string())); } } + println!("UAT: headers: {:?}", res.headers()); + println!("UAT: text: {:?}", res.text().await); // FIXME: Parse errors here better (checking if we're unauthorized,...) panic!("NO UAT Token in access_token"); } @@ -86,9 +92,10 @@ impl AdviceClient { ) }; - let req = self.client + let req = self + .client .get(&advice.image_url) - .header("Cookie", format!("UAT={}", uat.0)) + .header("Cookie", format!("AccessToken={}", uat.0)) .build() .unwrap(); let res = self.client.execute(req).await; @@ -150,5 +157,5 @@ fn headers() -> HeaderMap { } pub fn endpoint_access_tokens() -> &'static str { - "https://briefankuendigung.dhl.de/pdapp-web/access-tokens" + "https://briefankuendigung.enplify.dhl.de/pdapp-web/access-tokens" }