@@ -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
@@ -481,11 +484,14 @@ impl SpClient {
481
484
HeaderValue :: from_str ( & format ! ( "{} {}" , token. token_type, token. access_token, ) ) ?,
482
485
) ;
483
486
484
- if let Ok ( client_token) = self . client_token ( ) . await {
485
- headers_mut. insert ( CLIENT_TOKEN , HeaderValue :: from_str ( & client_token) ?) ;
486
- } else {
487
- // currently these endpoints seem to work fine without it
488
- warn ! ( "Unable to get client token. Trying to continue without..." ) ;
487
+ match self . client_token ( ) . await {
488
+ Ok ( client_token) => {
489
+ let _ = headers_mut. insert ( CLIENT_TOKEN , HeaderValue :: from_str ( & client_token) ?) ;
490
+ }
491
+ Err ( e) => {
492
+ // currently these endpoints seem to work fine without it
493
+ warn ! ( "Unable to get client token: {e} Trying to continue without..." )
494
+ }
489
495
}
490
496
491
497
last_response = self . session ( ) . http_client ( ) . request_body ( request) . await ;
0 commit comments