@@ -270,7 +270,10 @@ impl SpClient {
270270 match ClientTokenResponseType :: from_i32 ( message. response_type . value ( ) ) {
271271 // depending on the platform, you're either given a token immediately
272272 // or are presented a hash cash challenge to solve first
273- Some ( ClientTokenResponseType :: RESPONSE_GRANTED_TOKEN_RESPONSE ) => break message,
273+ Some ( ClientTokenResponseType :: RESPONSE_GRANTED_TOKEN_RESPONSE ) => {
274+ debug ! ( "Received a granted token" ) ;
275+ break message;
276+ }
274277 Some ( ClientTokenResponseType :: RESPONSE_CHALLENGES_RESPONSE ) => {
275278 debug ! ( "Received a hash cash challenge, solving..." ) ;
276279
@@ -480,11 +483,14 @@ impl SpClient {
480483 HeaderValue :: from_str ( & format ! ( "{} {}" , token. token_type, token. access_token, ) ) ?,
481484 ) ;
482485
483- if let Ok ( client_token) = self . client_token ( ) . await {
484- headers_mut. insert ( CLIENT_TOKEN , HeaderValue :: from_str ( & client_token) ?) ;
485- } else {
486- // currently these endpoints seem to work fine without it
487- warn ! ( "Unable to get client token. Trying to continue without..." ) ;
486+ match self . client_token ( ) . await {
487+ Ok ( client_token) => {
488+ let _ = headers_mut. insert ( CLIENT_TOKEN , HeaderValue :: from_str ( & client_token) ?) ;
489+ }
490+ Err ( e) => {
491+ // currently these endpoints seem to work fine without it
492+ warn ! ( "Unable to get client token: {e} Trying to continue without..." )
493+ }
488494 }
489495
490496 last_response = self . session ( ) . http_client ( ) . request_body ( request) . await ;
0 commit comments