@@ -270,7 +270,10 @@ impl SpClient {
270
270
match ClientTokenResponseType :: from_i32 ( message. response_type . value ( ) ) {
271
271
// depending on the platform, you're either given a token immediately
272
272
// 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
+ }
274
277
Some ( ClientTokenResponseType :: RESPONSE_CHALLENGES_RESPONSE ) => {
275
278
debug ! ( "Received a hash cash challenge, solving..." ) ;
276
279
@@ -479,11 +482,14 @@ impl SpClient {
479
482
HeaderValue :: from_str ( & format ! ( "{} {}" , token. token_type, token. access_token, ) ) ?,
480
483
) ;
481
484
482
- if let Ok ( client_token) = self . client_token ( ) . await {
483
- headers_mut. insert ( CLIENT_TOKEN , HeaderValue :: from_str ( & client_token) ?) ;
484
- } else {
485
- // currently these endpoints seem to work fine without it
486
- warn ! ( "Unable to get client token. Trying to continue without..." ) ;
485
+ match self . client_token ( ) . await {
486
+ Ok ( client_token) => {
487
+ let _ = headers_mut. insert ( CLIENT_TOKEN , HeaderValue :: from_str ( & client_token) ?) ;
488
+ }
489
+ Err ( e) => {
490
+ // currently these endpoints seem to work fine without it
491
+ warn ! ( "Unable to get client token: {e} Trying to continue without..." )
492
+ }
487
493
}
488
494
489
495
last_response = self . session ( ) . http_client ( ) . request_body ( request) . await ;
0 commit comments