diff --git a/core/src/spclient.rs b/core/src/spclient.rs index 99e2c1c6..44c92ba6 100644 --- a/core/src/spclient.rs +++ b/core/src/spclient.rs @@ -270,7 +270,10 @@ impl SpClient { match ClientTokenResponseType::from_i32(message.response_type.value()) { // depending on the platform, you're either given a token immediately // or are presented a hash cash challenge to solve first - Some(ClientTokenResponseType::RESPONSE_GRANTED_TOKEN_RESPONSE) => break message, + Some(ClientTokenResponseType::RESPONSE_GRANTED_TOKEN_RESPONSE) => { + debug!("Received a granted token"); + break message; + } Some(ClientTokenResponseType::RESPONSE_CHALLENGES_RESPONSE) => { debug!("Received a hash cash challenge, solving..."); @@ -480,11 +483,14 @@ impl SpClient { HeaderValue::from_str(&format!("{} {}", token.token_type, token.access_token,))?, ); - if let Ok(client_token) = self.client_token().await { - headers_mut.insert(CLIENT_TOKEN, HeaderValue::from_str(&client_token)?); - } else { - // currently these endpoints seem to work fine without it - warn!("Unable to get client token. Trying to continue without..."); + match self.client_token().await { + Ok(client_token) => { + let _ = headers_mut.insert(CLIENT_TOKEN, HeaderValue::from_str(&client_token)?); + } + Err(e) => { + // currently these endpoints seem to work fine without it + warn!("Unable to get client token: {e} Trying to continue without...") + } } last_response = self.session().http_client().request_body(request).await;