You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When multiple acquireTokenSilent requests are made in parallel there is
a chance that they will all need to fallback to the iframe flow. It is
both unnecessary for more than 1 iframe call to be made and results in a
perf and reliability degradation for all calls. This PR introduces a
mechanism to track in progress iframe calls and cause subsequent
requests to wait before retrying the cache and/or RT redemption.
Note: Telemetry dashboards will need to be updated after this change is
released to avoid counting awaited iframe calls against our perf metrics
more than once.
Note: This PR does not make any changes to ssoSilent - follow up work
should add ssoSilent calls to the active request tracking variable and
log warnings when more than 1 ssoSilent requests are made but should
**not** block the calls.
// Retry cache lookup and/or RT exchange after iframe completes
2062
+
returnthis.acquireTokenSilentNoIframe(
2063
+
silentRequest,
2064
+
cacheLookupPolicy
2065
+
);
2066
+
});
2067
+
}else{
2068
+
// Cache policy set to skip and another iframe request is already in progress
2069
+
this.logger.warning(
2070
+
"Another iframe request is currently in progress and CacheLookupPolicy is set to Skip. This may result in degraded performance and/or reliability for both calls. Please consider changing the CacheLookupPolicy to take advantage of request queuing and token cache.",
2071
+
silentRequest.correlationId
2072
+
);
2073
+
returninvokeAsync(
2074
+
this.acquireTokenBySilentIframe.bind(this),
2075
+
PerformanceEvents.AcquireTokenBySilentIframe,
2076
+
this.logger,
2077
+
this.performanceClient,
2078
+
silentRequest.correlationId
2079
+
)(silentRequest);
2080
+
}
2081
+
}else{
2082
+
// Error cannot be silently resolved or iframe renewal is not allowed, interaction required
* AcquireTokenSilent without the iframe fallback. This is used to enable the correct fallbacks in cases where there's a potential for multiple silent requests to be made in parallel and prevent those requests from making concurrent iframe requests.
2125
+
* @param silentRequest
2126
+
* @param cacheLookupPolicy
2127
+
* @returns
2128
+
*/
2129
+
privateasyncacquireTokenSilentNoIframe(
2130
+
silentRequest: CommonSilentFlowRequest,
2131
+
cacheLookupPolicy: CacheLookupPolicy
2132
+
): Promise<AuthenticationResult>{
1970
2133
if(
1971
2134
NativeMessageHandler.isNativeAvailable(
1972
2135
this.config,
1973
2136
this.logger,
1974
2137
this.nativeExtensionProvider,
1975
-
request.authenticationScheme
2138
+
silentRequest.authenticationScheme
1976
2139
)&&
1977
-
account.nativeAccountId
2140
+
silentRequest.account.nativeAccountId
1978
2141
){
1979
2142
this.logger.verbose(
1980
2143
"acquireTokenSilent - attempting to acquire token from native platform"
1981
2144
);
1982
-
constsilentRequest: SilentRequest={
1983
-
...request,
1984
-
account,
1985
-
};
1986
-
result=this.acquireTokenNative(
2145
+
returnthis.acquireTokenNative(
1987
2146
silentRequest,
1988
2147
ApiId.acquireTokenSilent_silentFlow
1989
2148
).catch(async(e: AuthError)=>{
@@ -1995,47 +2154,25 @@ export class StandardController implements IController {
1995
2154
this.nativeExtensionProvider=undefined;// Prevent future requests from continuing to attempt
1996
2155
1997
2156
// Cache will not contain tokens, given that previous WAM requests succeeded. Skip cache and RT renewal and go straight to iframe renewal
0 commit comments