Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang in ConfidentialClientApplicationBuilderExtension.WithClientCredentials #2566

Closed
xs4free opened this issue Nov 3, 2023 · 1 comment · Fixed by #2567
Closed

Hang in ConfidentialClientApplicationBuilderExtension.WithClientCredentials #2566

xs4free opened this issue Nov 3, 2023 · 1 comment · Fixed by #2567
Labels
Milestone

Comments

@xs4free
Copy link
Contributor

xs4free commented Nov 3, 2023

Microsoft.Identity.Web Library

Microsoft.Identity.Web.TokenAcquisition

Microsoft.Identity.Web version

2.15.3

Web app

Sign-in users and call web APIs

Web API

Protected web APIs (validating tokens)

Token cache serialization

In-memory caches

Description

In production the project that I'm currently working on, has experienced hangs on the sign-in proces of our Blazor Server website. We couldn't pinpoint the error in production, but I've found similar behaviour after starting the website locally a couple of times.
The code is hanging in ConfidentialClientApplicationBuilderExtension.WithClientCredentials on the line with

credentialsLoader.LoadCredentialsIfNeededAsync(credential, credentialSourceLoaderParameters).GetAwaiter().GetResult();

I've looked at the implementation of the potential credentials-loaders and found that the KeyVault-loader requires an async-path (maybe others as well).

I'm preparing a PR to make ConfidentialClientApplicationBuilderExtension.WithClientCredentialsAsync and the path upwards also async.

While making my change in the code I came across an obsolete message on ITokenAcquisition.ReplyForbiddenWithWwwAuthenticateHeader which pointed to Performance improvements and consequence on async methods in Microsoft.Identity.Web 1.9.0. So I suspect this bug has been in the code-base for a while.

Reproduction steps

Sorry, I'm not able to reproduce this consistently.

Error message

No error message, the application just halts and the browser shows a message that the server took to long to respond after a while.

Id Web logs

No response

Relevant code snippets

Sorry, I can't share the code of this application.

Regression

No response

Expected behavior

The call to ConfidentialClientApplicationBuilderExtension.WithClientCredentials to be fully async.

@jennyf19
Copy link
Collaborator

Included in 2.17.1 thanks @xs4free

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
2 participants