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

using pnp.framework in MVC web app with .net framework 4.6.x hangs #1090

Open
dean118 opened this issue Nov 17, 2024 · 0 comments
Open

using pnp.framework in MVC web app with .net framework 4.6.x hangs #1090

dean118 opened this issue Nov 17, 2024 · 0 comments

Comments

@dean118
Copy link

dean118 commented Nov 17, 2024

Using pnp.framework with .net framework 4.6.x in console and win from application works. However using pnp.framework in MVC web app with .net framework 4.6.x hangs, when calling method
public async Task GetContextAsync(string siteUrl, CancellationToken cancellationToken)

Tested accessing SPO with certificate app-only authentication, debugging in, specifically happens on .ConfigureAwait(false) in
catch block
Bolded below.

            case ClientContextType.AzureADCertificate:
                {

#pragma warning disable CS0618 // Type or member is obsolete
var accounts = await confidentialClientApplication.GetAccountsAsync().ConfigureAwait(false);
#pragma warning restore CS0618 // Type or member is obsolete

                    try
                    {
                        authResult = await confidentialClientApplication.AcquireTokenSilent(scopes, accounts.First()).ExecuteAsync(cancellationToken).ConfigureAwait(false);
                    }
                    catch
                    {
                        authResult = await confidentialClientApplication.AcquireTokenForClient(scopes).ExecuteAsync(cancellationToken)**.ConfigureAwait(false)**;
                    }
                    if (authResult.AccessToken != null)
                    {
                        return BuildClientContext(confidentialClientApplication, siteUrl, scopes, authenticationType);
                    }
                    break;
                }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant