@@ -16,26 +16,29 @@ class AcquireTokenSilentSupplier extends AuthenticationResultSupplier {
1616 @ Override
1717 AuthenticationResult execute () throws Exception {
1818 Authority requestAuthority = silentRequest .requestAuthority ();
19- if (requestAuthority .authorityType != AuthorityType .B2C ){
19+ if (requestAuthority .authorityType != AuthorityType .B2C ) {
2020 requestAuthority =
2121 getAuthorityWithPrefNetworkHost (silentRequest .requestAuthority ().authority ());
2222 }
2323
2424 AuthenticationResult res ;
2525
26- if (silentRequest .parameters ().account () == null ){
26+ if (silentRequest .parameters ().account () == null ) {
2727 res = clientApplication .tokenCache .getCachedAuthenticationResult (
2828 requestAuthority ,
2929 silentRequest .parameters ().scopes (),
3030 clientApplication .clientId ());
31- }
32- else {
31+ } else {
3332 res = clientApplication .tokenCache .getCachedAuthenticationResult (
3433 silentRequest .parameters ().account (),
3534 requestAuthority ,
3635 silentRequest .parameters ().scopes (),
3736 clientApplication .clientId ());
3837
38+ if (!StringHelper .isBlank (res .accessToken ())) {
39+ clientApplication .getServiceBundle ().getServerSideTelemetry ().incrementSilentSuccessfulCount ();
40+ }
41+
3942 if (silentRequest .parameters ().forceRefresh () || StringHelper .isBlank (res .accessToken ())) {
4043
4144 if (!StringHelper .isBlank (res .refreshToken ())) {
@@ -48,17 +51,15 @@ AuthenticationResult execute() throws Exception {
4851 new AcquireTokenByAuthorizationGrantSupplier (clientApplication , refreshTokenRequest , requestAuthority );
4952
5053 res = acquireTokenByAuthorisationGrantSupplier .execute ();
51- }
52- else {
54+ } else {
5355 res = null ;
5456 }
5557 }
5658 }
57- if (res == null || StringHelper .isBlank (res .accessToken ())){
59+ if (res == null || StringHelper .isBlank (res .accessToken ())) {
5860 throw new MsalClientException (AuthenticationErrorMessage .NO_TOKEN_IN_CACHE , AuthenticationErrorCode .CACHE_MISS );
5961 }
6062
61- clientApplication .getServiceBundle ().getServerSideTelemetry ().incrementSilentSuccessfulCount ();
6263 return res ;
6364 }
6465}
0 commit comments