0

WebApp-graph-user sample に基づくアプリで次のエラー スタックが発生しています。ログインして User.ReadBasic.All グラフ権限のトークンを取得しようとしています。AcquireTokenByAuthorizationCode に入るすべてのパラメーターを確認したところ、すべて問題ないように見えました (null 値はありません)。アプリは、.net core 3.1 を使用した MVC Web アプリです。

スタック:

NullReferenceException: オブジェクト参照がオブジェクトのインスタンスに設定されていません。Microsoft.Identity.Client.Internal.ClientCredentialWrapper.get_Thumbprint() Microsoft.Identity.Client.Internal.JsonWebToken+JWTHeaderWithCertificate..ctor(ClientCredentialWrapper 資格情報、bool sendCertificate) Microsoft.Identity.Client.Internal.JsonWebToken.EncodeHeaderToJson(ClientCredentialWrapper 資格情報、bool) sendCertificate) Microsoft.Identity.Client.Internal.JsonWebToken.Encode(ClientCredentialWrapper 資格情報、bool sendCertificate) Microsoft.Identity.Client.Internal.JsonWebToken.Sign(ClientCredentialWrapper 資格情報、bool sendCertificate) Microsoft.Identity.Client.Internal.Requests.ClientCredentialHelper. CreateClientCredentialBodyParameters(ICoreLogger ロガー、ICryptographyManager cryptographyManager、ClientCredentialWrapper clientCredential、CancellationToken cancelToken) Microsoft.Identity.Web.TokenAcquisition.AddAccountToCacheFromAuthorizationCodeAsync(AuthorizationCodeReceivedContext context, IEnumerable scopes) in TokenAcquisition.cs + var result = await application Microsoft.Identity.Web.WebAppServiceCollectionExtensions+<>c__DisplayClass2_1+<b__3>d.MoveNext() in WebAppServiceCollectionExtensions. cs + await tokenAcquisition.AddAccountToCacheFromAuthorizationCodeAsync(context, options.Scope).ConfigureAwait(false); Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.RunAuthorizationCodeReceivedEventAsync (OpenIdConnectMessage authorizationResponse、ClaimsPrincipal ユーザー、AuthenticationProperties プロパティ、JwtSecurityToken jwt) Microsoft.AspNetCore.Authentication.OpenIdConnect.OpenIdConnectHandler.

コード: TokenAcquisition.cs から - 127 行目

                // Do not share the access token with ASP.NET Core otherwise ASP.NET will cache it and will not send the OAuth 2.0 request in
                // case a further call to AcquireTokenByAuthorizationCodeAsync in the future is required for incremental consent (getting a code requesting more scopes)
                // Share the ID Token though
                var result = await application
                    .AcquireTokenByAuthorizationCode(scopes.Except(_scopesRequestedByMsal), context.ProtocolMessage.Code)
                    .ExecuteAsync()
                    .ConfigureAwait(false);
                context.HandleCodeRedemption(null, result.IdToken);
4

1 に答える 1