Skip to content

Commit 987aeb1

Browse files
authored
undo changes, wait on all delegates (#2524)
1 parent ceff540 commit 987aeb1

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Microsoft.Identity.Web/WebAppExtensions/MicrosoftIdentityWebAppAuthenticationBuilder.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,8 @@ internal static void WebAppCallsWebApiImplementation(
165165
};
166166

167167
// Handling the token validated to get the client_info for cases where tenantId is not present (example: B2C)
168-
options.Events.OnTokenValidated += async context =>
168+
var onTokenValidatedHandler = options.Events.OnTokenValidated;
169+
options.Events.OnTokenValidated = async context =>
169170
{
170171
string? clientInfo = context!.ProtocolMessage?.GetParameter(ClaimConstants.ClientInfo);
171172

@@ -179,7 +180,7 @@ internal static void WebAppCallsWebApiImplementation(
179180
context!.Principal!.Identities.FirstOrDefault()?.AddClaim(new Claim(ClaimConstants.UniqueObjectIdentifier, clientInfoFromServer.UniqueObjectIdentifier));
180181
}
181182
}
182-
await Task.CompletedTask;
183+
await onTokenValidatedHandler(context).ConfigureAwait(false);
183184
};
184185

185186
// Handling the sign-out: removing the account from MSAL.NET cache

0 commit comments

Comments
 (0)